Advertisement
ellesehc

Password_Policy_Template

Feb 18th, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. #First
  2. def passwordChecker():
  3.  
  4.     password = raw_input("Input password: ")
  5.  
  6.     if len(password) < 8:
  7.         print "Password is unacceptable. Should be more than 8 characters long."
  8.         passwordChecker()
  9.  
  10.     elif len(password) > 32:
  11.         print "Password is unacceptable. Should be less than 32 characters long."
  12.         passwordChecker()
  13.    
  14.     else:
  15.  
  16.         if any(char.isupper() for char in password) and any(char.islower() for char in password) and any(char.isdigit() for char in password):
  17.             print "Strong password!"
  18.  
  19.         else:
  20.             print "Weak Password!"
  21.             passwordChecker()
  22.  
  23. #Second
  24. def passwordChecker():
  25.     password = raw_input("Input password: ")
  26.     if len(password) < 8:
  27.         print "Password is unacceptable. Should be more than 8 characters long."
  28.         passwordChecker()
  29.     elif len(password) > 32:
  30.         print "Password is unacceptable. Should be less than 32 characters long."
  31.         passwordChecker()  
  32.     else:
  33.         if any(char.isupper() for char in password) and any(char.islower() for char in password) and any(char.isdigit() for char in password):
  34.             print "Strong password!"
  35.         else:
  36.             print "Weak Password!"
  37.             passwordChecker()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement