-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasso.py
More file actions
40 lines (30 loc) · 1.07 KB
/
passo.py
File metadata and controls
40 lines (30 loc) · 1.07 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
import re
def is_strong_password(password):
if len(password) < 8:
return False
if not re.search(r'[A-Z]', password):
return False
if not re.search(r'[a-z]', password):
return False
if not re.search(r'[0-9]', password):
return False
if not re.search(r'[!@#$%^&*()_+\-=\[\]{};:\'",.<>?/\\|`~]', password):
return False
return True
if __name__ == "__main__":
password = input("Enter a password: ")
missing = []
if len(password) < 8:
missing.append("at least 8 characters")
if not re.search(r'[A-Z]', password):
missing.append("an uppercase letter")
if not re.search(r'[a-z]', password):
missing.append("a lowercase letter")
if not re.search(r'[0-9]', password):
missing.append("a number")
if not re.search(r'[!@#$%^&*()_+\-=\[\]{};:\'",.<>?/\\|`~]', password):
missing.append("a special character")
if missing:
print(f"Password is weak. Missing: {', '.join(missing)}")
else:
print("Password is strong!")