Skip to content

Instantly share code, notes, and snippets.

@tylerkerr
Last active August 29, 2015 14:18
Show Gist options
  • Save tylerkerr/8b077383e58bbf0aca48 to your computer and use it in GitHub Desktop.
Save tylerkerr/8b077383e58bbf0aca48 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys, os
from passlib.hash import bcrypt
user = list()
usalt = list()
uhash = list()
pwhash = list()
pos = 0
f = open('db.txt', 'r')
db = f.readlines()
for i in db:
i = i.rstrip('\n')
line = i.split('\t', 2 )
user.append(line[1])
usalt.append(line[2][7:29])
uhash.append(line[2][29:])
f2 = open('commonpasswords.txt', 'r')
pws = f2.readlines()
for u in user:
print user[pos]
for pw in pws:
pw = pw.rstrip('\n')
crypt = bcrypt.encrypt(pw, rounds=10, salt=usalt[pos])
pwhash = crypt[29:]
if pwhash == uhash[pos]:
sys.stdout.write("GOT ONE!!!!!!!!!!!!!!!!!!!!! \n\n\n password: %s salt: %s pwhash: %s \n\n\n\n" % (pw, usalt, pwhash))
break
else:
sys.stdout.write("no on %s \t\t for %s, salt %s . user hash %s but bcrypt got %s \n" % (pw, user[pos], usalt[pos], uhash[pos], pwhash))
pos = pos + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment