Advertisement
Guest User

Untitled

a guest
May 4th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. from sys import argv
  2. from random import random, choice
  3.  
  4. a = 'AEIOUYaeiouy'
  5. b = 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz'
  6.  
  7. try:
  8. l = 10 if len(argv)<2 else int(argv[1])
  9. except:
  10. print('Bad length of password!')
  11. exit()
  12.  
  13. print('First way:')
  14. for i in range(5):
  15. p = ''
  16. while len(p)<l:
  17. p += choice(b)
  18. if random()>.5:
  19. p += choice(b)
  20. p += choice(a)
  21. print(' '+p[:l])
  22.  
  23. orig = 'qwertyuiopasdfghjklzxcvbnm'
  24. repl = ' 3 7 0 45 9 12 6 '
  25. words = []
  26. #p = argv[0][:argv[0].rfind('/')]
  27. #if p:
  28. # p += '/'
  29. p = ''
  30. with open(p+'words', 'r') as f:
  31. for i in f:
  32. words.append(i[:-1])
  33.  
  34. print('Second way:')
  35. for i in range(5):
  36. t = ''
  37. while len(t)<l:
  38. t += choice(words).capitalize()
  39. for a, b in zip(orig, repl):
  40. if b!=' ':
  41. t = t.replace(a, b)
  42. print(' '+t)
  43.  
  44. print('Third way:')
  45. for i in range(10):
  46. t = ''
  47. while len(t)<l:
  48. t += choice(words).capitalize()
  49. for a, b in zip(orig, repl):
  50. if b!=' ' and random()>.5:
  51. t = t.replace(a, b)
  52. print(' '+t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement