Guest User

Untitled

a guest
Nov 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. import random
  2.  
  3. # utilises random.choice
  4. # morphs big words into indecipherable passwords with random numbers and upper and lower cases if strong password. Weak: picks word from list
  5.  
  6. word_list = [
  7. "abnegation",
  8. "baseline",
  9. "adumbrate",
  10. "agrundize",
  11. "contusion",
  12. "exacerbate",
  13. "insidious",
  14. "pellucid",
  15. "zealous",
  16. "indecipherable",
  17. "unbelievable",
  18. "incoherent",
  19. "otherbigwords",
  20. "lmaoyoullneverguessthis",
  21. "justasmalltowngirl",
  22. "living in a lonely world"
  23. ]
  24.  
  25. def strong_random_gen():
  26. base_word = list(random.choice(word_list))
  27. new_word = []
  28. for letter in base_word:
  29. in_word = random.randrange(0,2)
  30. if in_word == 1: # randomly adds some letters to password
  31. to_upper = random.randrange(0,2)
  32. if to_upper == 1: # randomly makes some letters upper
  33. new_word.append(letter.upper())
  34. elif to_upper == 0:
  35. new_word.append(letter.lower())
  36. else:
  37. randnum = random.randrange(0,10)
  38. add_number = random.randrange(0,2) # randomly adds some numbers
  39. if add_number == 1:
  40. new_word.append(str(randnum))
  41. print(''.join(new_word))
  42.  
  43. def weak_random_gen():
  44. new_word = random.choice(word_list)
  45. print(new_word)
  46.  
  47.  
  48.  
  49. while True: # allows user to request for password (loop till 'n')
  50. pass_request = input("Generate a password? Y/n ").lower()
  51. weak_strong = input("Do you want password to be weak or STRONG?").lower()
  52. if pass_request != 'n':
  53. if weak_strong == 'weak':
  54. weak_random_gen()
  55. else:
  56. strong_random_gen()
  57. if pass_request == 'n':
  58. print("Ok, bye!")
  59. break
Add Comment
Please, Sign In to add comment