SQL v5

01/27/2009 22:29 GlobalFaer#1
MySQL v5 Hash Wordlist Cracker

submitted by d3hydr8 on 1/26/2009

Source: [Only registered and activated users can see links. Click Here To Register...]

#!/usr/bin/python
#Attempts to crack MySQL v5 hash using wordlist.
#[Only registered and activated users can see links. Click Here To Register...]
#d3hydr8[at]gmail[dot]com

import sys

def c1(word):
s = hashlib.sha1()
s.update(word[:-1])
s2 = hashlib.sha1()
s2.update(s.digest())
return s2.hexdigest()

def c2(word):
s = sha.new()
s.update(word[:-1])
s2 = sha.new()
s2.update(s.digest())
return s2.hexdigest()

if len(sys.argv) != 3:
print "Usage: ./mysql5crack.py "
sys.exit(1)

pw = sys.argv[1]
if len(pw) != 40:
print "Improper hash length"
sys.exit(1)
try:
words = open(sys.argv[2], "r")
except(IOError):
print "Error: Check your wordlist path"
sys.exit(1)
words = words.readlines()
print "Words Loaded:",len(words)

try:
import hashlib
for word in words:
if pw == c1(word):
print "Password is:",word
except(ImportError):
import sha
for word in words:
if pw == c2(word):
print "Password is:",word