-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpass_cracker.py
112 lines (106 loc) · 5.18 KB
/
pass_cracker.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import hashlib,argparse,os
def md5(hash,wordlist,format):
file = open(wordlist,'r')
for item in file.readlines():
pas = hashlib.md5(item.strip().encode()).hexdigest()
# pas.update(item.encode())
# final = pas.hexdigest()
print("[+] Hash type:",format)
if pas == hash:
print(f"\n[+] cracked\n[+] Hash: {hash}\n[+] Password:",item,'\n')
exit()
print("[!] Hash not cracked\n")
def sha1(hash,wordlist,format):
file = open(wordlist,'r')
for item in file.readlines():
pas = hashlib.sha1(item.strip().encode()).hexdigest()
# pas.update(item.encode())
# final = pas.hexdigest()
print("[+] Hash type:",format)
if pas == hash:
print(f"\n[+] cracked\n[+] Hash: {hash}\n[+] Password:",item,'\n')
exit()
print("[!] Hash not cracked\n")
def sha256(hash,wordlist,format):
file = open(wordlist,'r')
for item in file.readlines():
pas = hashlib.sha256(item.strip().encode()).hexdigest()
# pas.update(item.encode())
# final = pas.hexdigest()
print("[+] Hash type:",format)
if pas == hash:
print(f"\n[+] cracked\n[+] Hash: {hash}\n[+] Password:",item,'\n')
exit()
print("[!] Hash not cracked\n")
def sha384(hash,wordlist,format):
file = open(wordlist,'r')
for item in file.readlines():
pas = hashlib.sha384(item.strip().encode()).hexdigest()
# pas.update(item.encode())
# final = pas.hexdigest()
print("[+] Hash type:",format)
if pas == hash:
print(f"\n[+] cracked\n[+] Hash: {hash}\n[+] Password:",item,'\n')
exit()
print("[!] Hash not cracked\n")
def sha512(hash,wordlist,format):
file = open(wordlist,'r')
for item in file.readlines():
pas = hashlib.sha512(item.strip().encode()).hexdigest()
# pas.update(item.encode())
# final = pas.hexdigest()
print("[+] Hash type:",format)
if pas == hash:
print(f"\n[+] cracked\n[+] Hash: {hash}\n[+] Password:",item,'\n')
exit()
print("[!] Hash not cracked\n")
if __name__=='__main__':
print('''
██╗░░██╗░█████╗░░██████╗██╗░░██╗░█████╗░██████╗░░█████╗░░█████╗░██╗░░██╗███████╗██████╗░
██║░░██║██╔══██╗██╔════╝██║░░██║██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║░██╔╝██╔════╝██╔══██╗
███████║███████║╚█████╗░███████║██║░░╚═╝██████╔╝███████║██║░░╚═╝█████═╝░█████╗░░██████╔╝
██╔══██║██╔══██║░╚═══██╗██╔══██║██║░░██╗██╔══██╗██╔══██║██║░░██╗██╔═██╗░██╔══╝░░██╔══██╗
██║░░██║██║░░██║██████╔╝██║░░██║╚█████╔╝██║░░██║██║░░██║╚█████╔╝██║░╚██╗███████╗██║░░██║
╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝
v1.0 @ajmewal
\n''')
parse = argparse.ArgumentParser()
parse.add_argument('-H','--hash',help="Enter Your hash")
parse.add_argument('-w','--wordlist',help="Give the wordlist path")
parse.add_argument('-f','--format',help="Specify the hash format")
parse.add_argument('-l','--list-format',action='store_true',help="list the avilable hash format")
args = parse.parse_args()
support_format=['md5','sha1','sha256','sha384','sha512']
if args.list_format:
for i in support_format:
print('[+]',i)
exit()
hash = args.hash
if hash==None:
print("[?] please give a hash")
exit()
if args.wordlist==None:
print('[?] Give a wordlist')
exit()
elif os.path.isfile(args.wordlist):
wordlist=args.wordlist
else:
print("[?] wordlist is not avilable")
exit()
format=args.format
if format==None:
print('[?] Please specify a format for better result\n')
exit()
elif format not in support_format:
print("[!] Format is not supported please use -l for list formats\n")
exit()
if format=='md5':
md5(hash,wordlist,format)
elif format=='sha1':
sha1(hash,wordlist,format)
elif format=='sha256':
sha256(hash,wordlist,format)
elif format=='sha384':
sha384(hash,wordlist,format)
elif format=='sha512':
sha512(hash,wordlist,format)