-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_strength_checker.py
More file actions
85 lines (67 loc) · 2.64 KB
/
Copy pathpassword_strength_checker.py
File metadata and controls
85 lines (67 loc) · 2.64 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
def strength_checker(password,rating_counter):
upper_counter,lower_counter,character_counter,numeric_counter = 0,0,0,0
for i in password:
if i.isupper():
upper_counter += 1
if i.islower():
lower_counter += 1
if i.isnumeric():
numeric_counter += 1
for character in characters:
if i == character:
character_counter = character_counter + 1
if len(password) >= 8:
print("[+] The lenght seems ok [+]")
rating_counter += 1
else:
print("[-] Poor choice! not enough length[-] ")
print(rating_counter)
if upper_counter >= 1 and lower_counter >= 1 and len(password)>=8:
print("[+] Contains both upperscae and lowercase! Good ")
rating_counter = rating_counter+ 1
print(rating_counter)
elif (upper_counter >= 1 or lower_counter >= 1) and len(password)>=8:
rating_counter += 0.5
print(rating_counter)
print("[+] Not bad at lease either upper or lcase [+]")
elif((upper_counter >= 1 or lower_counter >= 1) and len(password)<= 8):
print("[-] Got the case work on length [-]")
else:
print(" [-] Again bad choice here [-] ")
print(rating_counter)
if numeric_counter >=3 and len(password)>=8:
print("[+] Contains {} numbers! Good [+] ".format(numeric_counter))
rating_counter += 1
print(rating_counter)
elif numeric_counter >=1 and len(password)>=8 :
print("[+] At least a digit [+]")
elif((numeric_counter >= 1) and len(password)<= 8):
print("[-] Got the digit work on length [-]")
rating_counter += 0.5
print(rating_counter)
else:
print("[-] no any digits [-]")
print(rating_counter)
if character_counter >=2 and len(password)>=8:
print("[+] Good more than a character [+] ")
rating_counter += 1
print(rating_counter)
elif(character_counter == 1 and len(password)>=8):
print("[-] at least a chracter [-]")
rating_counter += 0.5
elif(character_counter >=1 and len(password)<=8):
print("[-] Got the character work on length [-]")
else:
print("[-] Bad choice no chracters [-]")
print("the final rating counter is :",end=" ")
print(rating_counter)
if rating_counter == 4:
print("The pssword is strong!")
elif rating_counter >=2.5:
print("The password is ok")
else:
print("The password is poor")
rating= 0
characters = ("!@#$%^&*()_+{}:"">?<,./;'")
user_password = input("Enter the pass password: ")
strength_checker(user_password,rating)