-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsha256crack.py
More file actions
23 lines (20 loc) · 849 Bytes
/
sha256crack.py
File metadata and controls
23 lines (20 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pwn import *
import sys
if len(sys.argv) != 2:
print("Invalid Arguments !")
print(">> {} <sha256sum> ".format(sys.argv[0]))
exit()
wanted_hash = sys.argv[1]
password_file = "/usr/share/wordlists/rockyou.txt"
attempts = 0
with log.progress("Attempting to crack {}!\n".format(wanted_hash)) as p:
with open(password_file, "r", encoding="latin-1") as password_list:
for password in password_list:
password = password.strip("\n").encode("latin-1")
password_hash = sha256sumhex(password)
p.status("[{}] {} == {}".format(attempts, password.decode("latin-1"), password_hash))
if password_hash == wanted_hash:
p.success("Password has found after {} attempts! {} hashes to {}!".format(attempts, password.decode("latin-1"), password_hash))
exit()
attempts +=1
p.failure("Password hash not found!")