Python Hash Dictionary Attack
I have adapted my previous program to support sha1, sha224, sha256, sha384 and sha512 hashes, as well as md5 support. Pretty basic script that compares your hash to a wordlist returning the decrypted hash if its present in your dictionary file.
|
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 |
#!/usr/bin/python # import hashlib, readline, os, sys # set path to your wordlist passlist = "/path/to/pwdlist" def hashcrack(passlist, passhash): pl = open(passlist, "r") for line in pl.readlines(): line = line.strip('\n') # define hash type if len(passhash) == 32: type = hashlib.md5(line) elif len(passhash) == 40: type = hashlib.sha1(line) elif len(passhash) == 56: type = hashlib.sha224(line) elif len(passhash) == 60: type = hashlib.sha256(line) elif len(passhash) == 96: type = hashlib.sha384(line) elif len(passhash) == 128: type = hashlib.sha512(line) else: print "\n[-] Invalid hash\n" sys.exit() # run hash against wordlist if type.hexdigest() == passhash: print "\n[+] Hash found. Password is: %s\n" % line pl.close() if __name__ == '__main__': os.system('clear') passhash = raw_input("Please enter a hash: ") passhash = passhash.strip('\n') hashcrack(passlist,passhash) |
From what I can see this is a dictionary attack, not a bruteforcer
but nevertheless you may be interested in this
http://www.hackforums.net/showthread.php?tid=2209770
You are correct, title amended