Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98e4e34

Browse files
committed
add password strength checker tutorial
1 parentdc0a94c commit98e4e34

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
6868
-[How to Exploit Command Injection Vulnerabilities in Python](https://thepythoncode.com/article/how-to-exploit-command-injection-vulnerabilities-in-python). ([code](ethical-hacking/exploit-command-injection))
6969
-[How to Make Malware Persistent in Python](https://thepythoncode.com/article/how-to-create-malware-persistent-in-python). ([code](ethical-hacking/persistent-malware))
7070
-[How to Remove Persistent Malware in Python](https://thepythoncode.com/article/removingg-persistent-malware-in-python). ([code](ethical-hacking/remove-persistent-malware))
71+
-[How to Check Password Strength with Python](https://thepythoncode.com/article/test-password-strength-with-python). ([code](ethical-hacking/checking-password-strength))
7172

7273
-###[Machine Learning](https://www.thepythoncode.com/topic/machine-learning)
7374
-###[Natural Language Processing](https://www.thepythoncode.com/topic/nlp)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#[How to Check Password Strength with Python](https://thepythoncode.com/article/test-password-strength-with-python)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
fromzxcvbnimportzxcvbn
2+
importpprint,getpass,sys
3+
4+
5+
deftest_single_password():
6+
password=getpass.getpass("[?] Enter your password: ")
7+
result=zxcvbn(password)
8+
print(f"Value:{result['password']}")
9+
print(f"Password Score:{result['score']}/4")
10+
print(f"Crack Time:{result['crack_times_display']['offline_slow_hashing_1e4_per_second']}")
11+
print(f"Feedback:{result['feedback']['suggestions']}")
12+
#pprint.pp(result)
13+
14+
15+
deftest_multiple_passwords(password_file):
16+
try:
17+
withopen(password_file,'r')aspasswords:
18+
forpasswordinpasswords:
19+
result=zxcvbn(password.strip('\n'))
20+
print('\n[+] ######################')# for readability
21+
print(f"Value:{result['password']}")
22+
print(f"Password Score:{result['score']}/4")
23+
print(f"Crack Time:{result['crack_times_display']['offline_slow_hashing_1e4_per_second']}")
24+
print(f"Feedback:{result['feedback']['suggestions']}")
25+
#pprint.pp(result)
26+
27+
exceptException:
28+
print('[!] Please make sure to specify an accessible file containing passwords.')
29+
30+
31+
iflen(sys.argv)==2:
32+
test_multiple_passwords(sys.argv[1])
33+
eliflen(sys.argv)==1:
34+
test_single_password()
35+
else:
36+
print('Usage: python test_password_strength.py <file> (for a file containing passwords) or\
37+
\npython test_password_strength.py (for a single password.)')
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
password
2+
1234567
3+
abc123cba159
4+
Sioplabxtre_9lTGCE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
zxcvbn

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp