-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsha256-crack.py
23 lines (20 loc) · 897 Bytes
/
sha256-crack.py
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 = "passes.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!")