File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # coding=utf-8
2+ # Author: Vitor Ribeiro
3+
4+ #This a program to check the security of passwords.
5+
6+ # Passwords must be at least 8 characters long.
7+ # Passwords must contain at least one uppercase letter and one number.
8+
9+ import re , pyperclip
10+
11+ # First you need to copy your password to the clipboard, the program will do the rest.
12+
13+ password = pyperclip .paste ()
14+
15+ eightLettersRegex = re .compile (r'\S{8,}' )
16+
17+ oneUppercaseRegex = re .compile (r'[A-Z]' )
18+
19+ oneNumberRegex = re .compile (r'\d' )
20+
21+ check = {
22+ eightLettersRegex : 'Your password must be 8 letters' ,
23+ oneUppercaseRegex : 'Your password must have at least one uppercase Letter.' ,
24+ oneNumberRegex : 'Your password must have at least one number.'
25+ }
26+
27+ print ('Analyzing your password.' )
28+
29+ count = 1
30+ for regex , msg in check .items ():
31+ mo = regex .search (password )
32+ if mo == None :
33+ print (msg )
34+ break
35+ if count == len (check ):
36+ print ('Good! Your password is strong enough!' )
37+ count += 1
38+
39+ print ('End.' )
You can’t perform that action at this time.
0 commit comments