-
Notifications
You must be signed in to change notification settings - Fork 6
/
sha2-512-crack
executable file
·97 lines (78 loc) · 2.99 KB
/
sha2-512-crack
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/python3
#Tool Name = Home-baked-hash-cracker
#Author = ASHWINI SAHU (GitHub : ASHWIN990)
#Date = 19/05/2020
import argparse
import os
import sys
import hashlib
## COLOR ##
black_col="\u001b[30;1m"
red_col="\u001b[31;1m"
green_col="\u001b[32;1m"
yellow_col="\u001b[33;1m"
blue_col="\u001b[34;1m"
magenta_col="\u001b[35;1m"
cyan_col="\u001b[36;1m"
white_col="\u001b[37;1m"
reset_col="\u001b[0m"
def banner():
print(f"""{white_col}
) )
( /( ( ( /( (
)\()) ( )\ )\()) )\
((_)\ )((_)((_)\ (((_)
_((_)((_)_ _((_) )\___
| || | | _ )| || |((/ __|
| __ | | _ \| __ | | (__
|_||_| |___/|_||_| \___|
{yellow_col}HOME BAKED HASH CRACKER{reset_col}""")
def main():
parser = argparse.ArgumentParser(description=f"SHA2-512 Hash Cracker, Writeen by : {blue_col}ASHWINI SAHU{reset_col}, GITHUB : https:github.com/ASHWIN990")
parser.add_argument("--hash", metavar="HASH", required=True, type=str, help="Provide the path of the file of SHA2-512 hash." )
parser.add_argument("--wordlist", metavar="WORDLIST", required=True, type=str, help="Provide the path of Wordlist.")
args = parser.parse_args()
print(f"\n{cyan_col}SHA2-512 Hash Cracker{reset_col}\n")
if os.path.isfile(args.hash):
sha512hash_path = args.hash
else:
print(f"{yellow_col}Hash path '{red_col}{args.hash}{yellow_col}' : not found.{reset_col}")
exit(0)
if os.path.isfile(args.wordlist):
wordlist_path = args.wordlist
else:
print(f"{yellow_col}Wordlist path '{red_col}{args.wordlist}{yellow_col}' : not found.{reset_col}")
exit(0)
hash_data = [line.strip() for line in open(sha512hash_path, 'r')]
wordlist_data = [line.strip() for line in open(wordlist_path, 'r')]
if len(hash_data) == 0:
print(f"{red_col}Hash file is empty{reset_col}")
exit(0)
if len(wordlist_data) == 0:
print(f"{red_col}Wordlist file is empty{reset_col}")
exit(0)
hash_data_fin=[]
for sha512hasher in hash_data:
if len(sha512hasher) == 128:
hash_data_fin.append(sha512hasher)
else:
print(f"\n{white_col}{sha512hasher}{yellow_col} : is not a SHA2-512 Hash{reset_col}\n")
if len(hash_data_fin) == 0:
print(f"\n{red_col}No valid SHA2-512 hash found.{reset_col}")
exit(0)
for sha512hash in hash_data_fin:
for words in wordlist_data:
print(f"\r{yellow_col}Testing : '{blue_col}{words}{reset_col}'", end=' ', flush=True)
if sha512hash == hashlib.sha512(words.encode()).hexdigest():
sha512crack=words
pass_found = True
break
else:
pass_found = False
if pass_found == True:
print(f"\n{white_col}CONGRATULATIONS PASSWORD FOUND : {green_col}{sha512crack}{reset_col}")
else:
print(f"\n{red_col}No password found in Wordlist use another{reset_col}")
if __name__ == "__main__":
banner()
main()