Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- import random
- upperLetters = (string.ascii_uppercase)
- lowerLetters = (string.ascii_lowercase)
- digits = (string.digits)
- specialChars = (string.punctuation)
- i = 0
- k = 0
- chars = ""
- password = ""
- print("Einfacher Passwortgenerator")
- print("by HeikoHDE")
- askLowerLetters = (str.lower(input("Sollen in Ihrem Passwort Kleinbuchstaben vorkommen? [J/N] ")))
- askUpperLetters = (str.lower(input("Sollen in Ihrem Passwort Großbuchstaben vorkommen? [J/N] ")))
- askDigits = (str.lower(input("Sollen in Ihrem Passwort Zahlen vorkommen? [J/N] ")))
- askSpecialChars = (str.lower(input("Sollen in Ihrem Passwort Sonderzeichen vorkommen? [J/N] ")))
- askLenght = (int(input("Aus wie vielen Zeichen soll Ihr Passwort bestehen? [1-100] ")))
- askCount = (int(input("Wie viele Passwörter sollen generiert werden? [1-100] ")))
- if (askLowerLetters == "j"):
- chars += lowerLetters
- if (askUpperLetters == "j"):
- chars += upperLetters
- if (askDigits == "j"):
- chars += digits
- if (askSpecialChars == "j"):
- chars += specialChars
- if (chars == ""):
- print("Sie haben keine Zeichen gewählt, aus denen Ihr Passwort bestehen kann.")
- while (i < askCount):
- while (k < askLenght):
- password += (random.choice(chars))
- k += 1
- print (password)
- password = ""
- k = 0
- i += 1
- print ("Ich hoffe Ihnen hat mein kleiner Passwortgenerator gefallen.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement