-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathhash_cracker.py
60 lines (49 loc) · 1.66 KB
/
hash_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
#!/usr/bin/env python
print """
*--------------------------------------*
| Coded by : mohamed |
| fb.me/hack1lab |
*--------------------------------------*
_ _ _ _
| |__ __ _ ___| | _| | __ _| |__
| '_ \ / _` |/ __| |/ / |/ _` | '_ \
| | | | (_| | (__| <| | (_| | |_) |
|_| |_|\__,_|\___|_|\_\_|\__,_|_.__/
python hacking
--------------
"""
import hashlib
from optparse import *
def hashing(word, algorithm):
""" algorithms available: ['md4', 'md5', 'sha1', 'sha256' .... etc] """
hash_type = hashlib.new(algorithm)
hash_type.update(word)
return hash_type.hexdigest()
parser = OptionParser("""
#Usage:
python cracker.py -w <hash> -t <type> -f <word list file>
#Example:
python cracker.py -w 7052cad6b415f4272c1986aa9a50a7c3 -t md5 -f wordlist.txt
""")
parser.add_option("-w",dest="ha_sh",type="string",help="enter hash string")
parser.add_option("-t",dest="ty_pe",type="string",help="enter type the hash")
parser.add_option("-f",dest="fi_le",type="string",help="enter file word list")
(options,args) = parser.parse_args()
if options.ha_sh == None or options.ty_pe == None or options.fi_le == None:
print(parser.usage)
exit(0)
else:
ha_sh = str(options.ha_sh)
ty_pe = str(options.ty_pe)
fi_le = str(options.fi_le)
read_list = open(fi_le,'r')
for word in read_list:
word = word.strip("\n")
result = hashing(word, ty_pe)
print("Testing: "+word)
if ha_sh == result:
print ("\nHash Found: [ {} ] >> word: [ {} ]".format(result,word))
exit(0)
else:
continue
print("\n\thash not found :(\n")