the last unbiased stronghold

MySQL SHA1 Hash Brute Forcer

MySQL SHA1 Hash Brute Forcer
Posted Feb 3, 2009
Authored by thebug | Site ulissescastro.wordpress.com

MySQL double SHA1 hash wordlist brute forcer written in Python.

tags | exploit, python
MD5 | 9eb565bacb9d27622e12f02f390587ca

MySQL SHA1 Hash Brute Forcer

Change Mirror Download
#!/usr/bin/env python
import sys

try:
import hashlib
except ImportError:
print '''
You need hashlib.
Update your python to version 2.5\n'''
sys.exit(1)

def license():
'''Print the usage license to this software, yeah, it's the same as above'''
print '''
%s - MySQL double SHA1 hash wordlist brute forcer. This cracker works against
hash created by MySQL to store passwords.

Copyright (c) 2009 Ulisses "thebug" Castro <uss.thebug@nospam@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
''' % sys.argv[0]

def makelist(file):
'''
Make word list
'''
items = []

try:
fd = open(file, 'r')

for line in fd.readlines():
item = line.replace('\n', '').replace('\r', '')
items.append(item)

return items

except IOError:
print 'unable to read file \'%s\'' % file
pass

except Exception, e:
print 'unknown error'
pass

def testword(text):
"""
Hash string twice with SHA1 (double SHA1), make UPPER and add an asterix.
"""
pazz = hashlib.sha1(text).digest()
pazz2 = hashlib.sha1(pazz).hexdigest()
return "*" + pazz2.upper()

if __name__ == '__main__':
from optparse import OptionError
from optparse import OptionParser

version = '''----------------------------------------------------------------------
MySQL double SHA1 hash brute force
version 0.1 uss.thebug[at]gmail.com
----------------------------------------------------------------------'''

usage = '%s [-H hash] [-w wordlist] [-t word-to-hash] [-v]' % sys.argv[0]

parser = OptionParser(version=version, usage=usage)

parser.add_option('-H', dest='hash', help='hash. (format: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9)')
parser.add_option('-w', dest='wordlist', help='wordlist to run against hash')
parser.add_option('-t', dest='wordtohash', help='transform word to hash')
parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='verbose')
parser.add_option('-l', '--license', action='store_true', dest='license', help='license')

(options, args) = parser.parse_args()

hash = options.hash
wordlist = options.wordlist
wordtohash = options.wordtohash

if options.license:
license()
sys.exit(0)

if options.wordtohash:
print "[*] MySQL double SHA1 hasher (by thebug)"
print "[*] word: %s" % wordtohash
print "[*] hash: %s" % testword(wordtohash)
sys.exit(0)

if not options.wordlist:
parser.print_help()
sys.exit(1)

if int(len(hash)) != 41 or hash[:1] != "*":
print "Improper hash format. Format: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9\n"
sys.exit(1)

words = makelist(wordlist)

print "[*] MySQL double SHA1 hash brute force (by thebug)"
print "[*] hash: %s" % hash
print "[*] %s word(s) loaded." % str(len(words))
print "[*] brute force started."

for word in words:
if options.verbose:
print "[+] word: %s" % word

if hash == testword(word):
print "\n[*] got it!"
print "[*] password is: %s\n" % word
sys.exit(0)
else:
pass

print "[*] Done.\n"
sys.exit(0)

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close