-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpass_valid.py
More file actions
43 lines (35 loc) · 1.08 KB
/
pass_valid.py
File metadata and controls
43 lines (35 loc) · 1.08 KB
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
#password validation script
#function for evaluating each condition
def pass_eval(passwd):
#initialize indicator for eval
stat = True
#initialize indicators and references for conditions
symbols = ['!', '@', '#', '$', '%', '&', '*']
symcount = 0
numcount = 0
capcount = 0
lowcount = 0
spacount = 0
#evaluate specific occurances within password
for i in passwd:
if i in symbols:
symcount += 1
elif i.isdigit() == True
numcount += 1
elif i.islower() == True:
capcount += 1
elif i.isupper() == True:
lowcount += 1
elif i.isspace() == True:
spacount += 1
#analyze conditions that must be met for password to be valid
if len(passwd) < 9 or spacount != 0 or symcount < 2 or numcount < 2 or capcount < 2 or lowcount < 2:
stat = False
return stat
#accept password to attempt
userpasswd = input("Enter A Password: ")
#evaluate the password
if pass_eval(userpasswd) == True:
print ("Password Accepted")
else:
print("Password Invalid")