Advertisement
Guest User

Untitled

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