Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- import random
- def strong_pass():
- pass_len = 20
- poss_char = string.ascii_letters + string.digits + string.punctuation
- return ''.join(random.choices(poss_char, k=pass_len))
- def weak_pass():
- with open('16.words_alpha.txt', "r") as dict_words:
- words = [word.strip() for word in dict_words.readlines()]
- return ' '.join(random.sample(words, 2))
- def get_mode():
- while True:
- input_text = "Type 'w' for a weak password or 's' for a strong one: "
- tmp = input(input_text).lower()
- if tmp in ['w', 's']:
- return tmp
- def main():
- tmp = get_mode()
- if tmp == "w":
- print(weak_pass())
- else:
- print(strong_pass())
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment