-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpasswdcheck.py
56 lines (52 loc) · 1.48 KB
/
passwdcheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
passwdcheck.py: CIS 210 assignment 1b, Fall 2013
author: Austin Bitterman Dayton, Mark Poliquin
Credits: Consulted Mark Poliquin on entirety of code, consulted assignment page
including linked examples
Check password requirements
"""
##import password from command line
import sys
passwd = sys.argv[1]
##password must contain at least 6 characters
lengthChar = False
if (len(passwd) >= 6) :
lengthChar = True
##password must contain lower case letter
caseLower = False
for character in passwd:
if(character.islower()):
caseLower = True
##password must contain upper case letter
caseUpper = False
for character in passwd:
if(character.isupper()):
caseUpper = True
##password must contain one digit 0-9
numDigit = False
for character in passwd:
if(character.isdigit()):
numDigit = True
##if the password meets all conditions, print "Good password"
if lengthChar + caseLower + caseUpper + numDigit:
print("Good password")
##if password does not have correct character length, print notification
if lengthChar:
pass
else:
print("Password must be at least 6 characters long")
##if password does not have a lower case character, print notification
if caseLower:
pass
else:
print("Password must include lower case letters")
##if password does not have an upper case character, print notification
if caseUpper:
pass
else:
print("Password must include upper case letters")
##if password does not have number digit, print notification
if numDigit:
pass
else:
print("Password must include digits")