-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasswordChecker.py
59 lines (52 loc) · 3.03 KB
/
PasswordChecker.py
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
from getpass import getpass
import sys
from rich import print as printc
from password_characteristics import check_character_occurences_in_password, check_password_characters_mixture
from password_characters_occurences import get_password_characters_occurences
from password_generator import password_generator
from password_entropy import get_entropy, password_level_sensibility
from have_i_been_pwned_check import check_haveibeenpwned_db
if __name__ == '__main__':
# Display banner
print("""
.--------.
/ .------. \\
/ / \ \\
| | | |
_| |________| |_
.' |_|P4SSW0RD|_| '.
'._____ ____ _____.'
| .'_____'. |
'.__.'.' '.'.__'
'.__ | CHECK | __'
| '.'.____.'.' |
'.____'.____.'____.'
'.________________.'Author: 0LIVERFLOW | Version: 1.0
\n""")
user_password = getpass('Enter your passw0rd: ')
# Checking Have I Been Pwned Database
printc("\n[cyan3 bold underline][*] Checking HaveIBeenPwned database[/cyan3 bold underline]")
printc(check_haveibeenpwned_db(user_password))
# Checking user's password characters occurences and mixture
password_characters_occurences_dict, alphanumerical_characters_list = get_password_characters_occurences(user_password)
check_password_characters_mixture(password_characters_occurences_dict, alphanumerical_characters_list)
# Getting the password entropy
printc("[cyan3 bold underline][*] Password entropy[/cyan3 bold underline]")
password_entropie = get_entropy(len(user_password), password_characters_occurences_dict)
printc(password_level_sensibility(password_entropie))
# Asking the user if they want to generate a password
printc("\n[cyan3 bold underline][*] Password Generator[/cyan3 bold underline]")
try:
user_response = input('Do you wanna generate a password using our password generator [Yay/nay]: ')
if user_response.lower() in ['','yay', 'yes', 'y', 'yeah', 'yep']:
while True:
password_length = input('Enter the password length: ')
if password_length.isdigit() and int(password_length) >= 20:
break
printc('The password should have at least [red b]20[/red b] characters!')
password_generator(int(password_length))
printc(f"[green1 b][+][/green1 b] The generated password was securely copied in your clipboard!")
except KeyboardInterrupt:
sys.exit(print("\nGood Bye!"))
print("────────────────────────────────────────────────────────────────────────────")
printc("[yellow1 b][!][/yellow1 b] Don't forget to [red1 b]CHANGE[/red1 b] your password [red1 b]ASAP[/red1 b] if it was considered unsecure.")