Advertisement
Guest User

Untitled

a guest
Mar 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #Генератор паролей, йепта
  2.  
  3. import random
  4.  
  5. lowcase = list("qwertyuiopasdfghjklzxcvbnm")
  6. upcase = list("QWERTYUIOPASDFGHJKLZXCVBNM")
  7. numbers = list("1234567890")
  8. chars = []
  9.  
  10. passlength = 0
  11. lowercase_true = ''
  12. upcase_true = ''
  13. numbers_true = ''
  14. password = ''
  15. while lowercase_true != 'Y' and lowercase_true != 'N':
  16. lowercase_true = input('Do you want lowcase symbols in your password? Type Y or N \n')
  17. print("You choose lowercase:", lowercase_true)
  18.  
  19. while upcase_true != 'Y' and upcase_true != 'N':
  20. upcase_true = input('Do you want upcase symbols in your password? Type Y or N \n')
  21. print("You choose upcase:", upcase_true)
  22.  
  23. while numbers_true != 'Y' and numbers_true != 'N':
  24. numbers_true = input('Do you want numbers in your password? Type Y or N \n')
  25. print("You choose numbers:", numbers_true)
  26.  
  27. while passlength == 0:
  28. try:
  29. passlength = int(input('Enter pass length'))
  30. print("Pass length", passlength)
  31. if passlength != 0:
  32. break
  33. except Exception:
  34. print("Invalid number \n")
  35.  
  36. if lowercase_true == 'Y':
  37. chars.extend(lowcase)
  38. if upcase_true == 'Y':
  39. chars.extend(upcase)
  40. if numbers_true == 'Y':
  41. chars.extend(numbers)
  42.  
  43. print("Using chars:", chars)
  44.  
  45. for _ in range(passlength):
  46. password += random.choice(chars)
  47.  
  48. print("Your password", password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement