Guest User

Untitled

a guest
Nov 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import sys
  2.  
  3. passcheck = input("Enter a password to check: ")
  4.  
  5. checking = set(passcheck)
  6.  
  7. passlength = len(passcheck)
  8.  
  9. points = 0
  10.  
  11. symbols = {'!','$','%','^','&','*','(',')','-','_','=','+'}
  12. qwerty = ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
  13.  
  14.  
  15.  
  16.  
  17. if passlength < 8 or passlength > 24:
  18. print("ERROR. Password must be between 8-24 characters long")
  19.  
  20.  
  21. else:
  22. for i in qwerty:
  23. if i in passcheck: #If entered password is in the form of 'QWERTY': subtract 15 points.
  24. points-=15
  25. print("Your password contain form of 'QWERTY' , Don't use weak password.")
  26. print(points)
  27. sys.exit()
  28.  
  29. if any(i.islower() for i in checking) or any(i.isupper() for i in checking) or any(i for i in checking if i in symbols) or any(i.isdigit() for i in checking):
  30. points+=5 #If there is at least one 'capital', 'lower case', 'symbol' or 'number': add 5 points.
  31.  
  32.  
  33. if any(i.islower() for i in checking) and any(i.isupper() for i in checking) and any(i.isdigit() for i in checking):
  34. points += 15 #If there is a capital and a number and a lower: add 15 points.
  35.  
  36.  
  37.  
  38. print(points)
Add Comment
Please, Sign In to add comment