SHOW:
|
|
- or go back to the newest paste.
1 | #Attempts to crack hash ( md5, sha1, sha256, sha384, sha512) against any givin wordlist. | |
2 | ||
3 | ||
4 | import os, sys ,hashlib | |
5 | ||
6 | if len(sys.argv) != 4: | |
7 | print " \n [email protected]" | |
8 | print "\n\nUsage: ./hash.py <hash algorithm > <hash> <wordlist>" | |
9 | print "\n Example: /hash.py <md5 or sha1 or sha256 or sha384 or sha512> <hash> <wordlist>" | |
10 | sys.exit(1) | |
11 | ||
12 | algo=sys.argv[1] | |
13 | pw = sys.argv[2] | |
14 | wordlist = sys.argv[3] | |
15 | try: | |
16 | words = open(wordlist, "r") | |
17 | except(IOError): | |
18 | print "Error: Check your wordlist path\n" | |
19 | sys.exit(1) | |
20 | words = words.readlines() | |
21 | print "\n",len(words),"words loaded..." | |
22 | file=open('cracked.txt','a') | |
23 | if algo == 'md5': | |
24 | for word in words: | |
25 | hash = hashlib.md5(word[:-1]) | |
26 | value = hash.hexdigest() | |
27 | if pw == value: | |
28 | print "Password is:",word,"\n" | |
29 | file.write("\n Cracked Hashes\n\n") | |
30 | file.write(pw+"\t\t") | |
31 | file.write(word+"\n") | |
32 | if algo == 'sha1': | |
33 | for word in words: | |
34 | hash = hashlib.sha1(word[:-1]) | |
35 | value = hash.hexdigest() | |
36 | if pw == value: | |
37 | print "Password is:",word,"\n" | |
38 | file.write("\n Cracked Hashes\n\n") | |
39 | file.write(pw+"\t\t") | |
40 | file.write(word+"\n") | |
41 | if algo == 'sha256': | |
42 | for word in words: | |
43 | hash = hashlib.sha256(word[:-1]) | |
44 | value = hash.hexdigest() | |
45 | if pw == value: | |
46 | print "Password is:",word,"\n" | |
47 | file.write("\n Cracked Hashes\n\n") | |
48 | file.write(pw+"\t\t") | |
49 | file.write(word+"\n") | |
50 | ||
51 | if algo == 'sha384': | |
52 | for word in words: | |
53 | hash = hashlib.sha384(word[:-1]) | |
54 | value = hash.hexdigest() | |
55 | if pw == value: | |
56 | print "Password is:",word,"\n" | |
57 | file.write("\n Cracked Hashes\n\n") | |
58 | file.write(pw+"\t\t") | |
59 | file.write(word+"\n") | |
60 | ||
61 | ||
62 | if algo == 'sha512': | |
63 | for word in words: | |
64 | hash = hashlib.sha512(word[:-1]) | |
65 | value = hash.hexdigest() | |
66 | if pw == value: | |
67 | print "Password is:",word,"\n" | |
68 | file.write("\n Cracked Hashes\n\n") | |
69 | file.write(pw+"\t\t") | |
70 | file.write(word+"\n") |