Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- import random
- upperLetters = (string.ascii_uppercase) # A-Z
- lowerLetters = (string.ascii_lowercase) # a-z
- digits = (string.digits) # 0-9
- specialChars = (string.punctuation) # !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
- i = 0
- k = 0
- chars = ""
- password = ""
- print()
- print(" +-----------------------------+")
- print(" | Einfacher Passwortgenerator |")
- print(" | by HeikoHDE |")
- print(" +-----------------------------+")
- print()
- 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] ")))
- print()
- 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.")
- print()
- for i in range(askCount):
- for k in range(askLenght):
- password += (random.choice(chars))
- print(" " + password)
- password = ""
- k = 0
- print()
- print(" Ich hoffe Ihnen hat mein kleiner Passwortgenerator gefallen.")
- print()
- input(" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement