You are here: Main Site >> Codebase >> Python >> MD5 Wordlist Cracker 
 

MD5 Wordlist Cracker

hartsmor
CodeCount: 19
Posted: 8th March 07:26pm

Information:

A MD5 wordlist cracker.

Python Code:
import hashlib, linecache, os, sys
 
if len(sys.argv) != 3:
	print "MD5 Wordlist Cracker by HartSmor\n"
	print "<Hash> <WordList>"
	sys.exit(1)
 
if len(sys.argv[1]) != 32:
	print "Invalid Hash"
	sys.exit(1)
 
if os.path.exists(sys.argv[2]) == 0:
	print "Can't Find Wordlist"
	sys.exit(1)
 
f = open (sys.argv[2], "r")
words = len(f.readlines())
wordlist = sys.argv[2]
hashin = sys.argv[1]
fails = 0
x = 1
y = 2
 
while 1:
	try:
		line0 = linecache.getline(wordlist, x)
		line = line0.replace("\n", "")
		Hash0 = unicode(line,"iso-8859-15")
		Hash = hashlib.md5(Hash0.encode("latin-1")).hexdigest()
		if Hash == hashin:
			os.system("cls")
			remaining = int(words) - int(x)
			print "Words: "+'"'+str(words)+'"'+"\n"+"Current Word: "+'"'+line.decode("latin-1")+'"'+"\n"+"Position: "+'"'+str(x)+'"'+"\n"+"Remaining: "+'"'+str(remaining)+'"'+"\n"+"Hash: " +'"'+str(Hash)+'"'+"\n"+"Fails: "+'"'+str(fails)+'"'
			print ""
			print "Password is: "+'"'+line.decode("latin-1")+'"'
			break
		if x > words:
			os.system("cls")
			remaining = int(words) - int(x)
			print "Words: "+'"'+str(words)+'"'+"\n"+"Current Word: "+'"'+line.decode("latin-1")+'"'+"\n"+"Position: "+'"'+str(x)+'"'+"\n"+"Remaining: "+'"'+str(remaining)+'"'+"\n"+"Hash: " +'"'+str(Hash)+'"'+"\n"+"Fails: "+'"'+str(fails)+'"'
			print ""
			print "Couldn't Find Password"
			break
		x = x + 1
	except:
		fails = fails + 1
		x = x + 1
	if x == y:
		os.system("cls")
		remaining = int(words) - int(x)
		print "Words: "+'"'+str(words)+'"'+"\n"+"Current Word: "+'"'+line.decode("latin-1")+'"'+"\n"+"Position: "+'"'+str(x)+'"'+"\n"+"Remaining: "+'"'+str(remaining)+'"'+"\n"+"Hash: " +'"'+str(Hash)+'"'+"\n"+"Fails: "+'"'+str(fails)+'"'
		y = y + 312345

Comments

Information:

No Comments.