-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswardcheck.py
More file actions
61 lines (59 loc) · 1.9 KB
/
passwardcheck.py
File metadata and controls
61 lines (59 loc) · 1.9 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import string
def check_passward(passward):
lower_letter=0
upper_letter=0
special_char=0
white_space=0
digit_num=0
for char in list(passward):
if char in string.ascii_lowercase:
lower_letter+=1
elif char in string.ascii_uppercase:
upper_letter+=1
elif char==" ":
white_space+=1
elif char in string.digits:
digit_num+=1
else:
special_char+=1
strength=0
remarks=" "
if lower_letter>=1:
strength+=1
if upper_letter>=1:
strength+=1
if white_space>=1:
strength+=1
if digit_num>=1:
strength+=1
if special_char>=1:
strength+=1
if strength==1:
remarks="That's a very bad password. Change it as soon as possible."
elif strength==2:
remarks= "That's not a good password. You should consider making a tougher password."
elif strength==3:
remarks = "Your password is okay, but it can be improved a lot"
elif strength == 4:
remarks = "Your password is hard to guess. But you can make it even more secure"
elif strength == 5:
remarks = "Now that's one hell of a strong password !!! Hackers don't have a chance guessing that password."
print("your passward has:")
print(f"{lower_letter} lower letter")
print(f"{upper_letter} upper letter")
print(f"{white_space} white space")
print(f"{digit_num} digit number")
print(f"{special_char} special char")
print(f"Passward score: {strength}/5")
print(f"remarks: {remarks}")
print("===welcome to passward check===")
while True:
choice=input("Do you want to check passward (yes or no):")
if choice.lower()=="yes":
passward=input("enter your passward:")
check_passward(passward)
elif choice.lower()=="no":
print("Exit")
break
else:
print("enter valid choice....try again")