1
0
Fork 0
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

17 Zeilen
819 B
Python

#!/usr/bin/python3
from argparse import ArgumentParser
from secrets import choice
from sys import path
if __name__ == "__main__":
ap = ArgumentParser(description="Generates a password out of common german words", prog="wordpass.py")
ap.add_argument("-l", "--length", type=int, default=5, help="Number of words (default: 5)")
ap.add_argument("-c", "--count", type=int, default=1, help="Number of passwords (default: 1)")
ap.add_argument("--lang", type=str, default="DE", help="Language code (default: DE)")
args = ap.parse_args()
file_path = ("" if path[0] == "" else path[0] + "/") + f"words_{args.lang}.txt"
with open(file_path) as wl:
words = wl.readlines()
for j in range(args.count):
print(''.join(choice(words).strip().title() for i in range(args.length)))