automatically writing uncracked hashes to a file for eventual further processing

This commit is contained in:
Miroslav Stampar 2012-05-08 10:46:05 +00:00
parent 80ee687b41
commit a121339395
2 changed files with 21 additions and 2 deletions

View File

@ -486,12 +486,12 @@ class Dump:
if conf.replicate: if conf.replicate:
rtable.endTransaction() rtable.endTransaction()
logger.info("Table '%s.%s' dumped to sqlite3 file '%s'" % (db, table, replication.dbpath)) logger.info("table '%s.%s' dumped to sqlite3 file '%s'" % (db, table, replication.dbpath))
else: else:
dataToDumpFile(dumpFP, "\n") dataToDumpFile(dumpFP, "\n")
dumpFP.close() dumpFP.close()
logger.info("Table '%s.%s' dumped to CSV file '%s'" % (db, table, dumpFileName)) logger.info("table '%s.%s' dumped to CSV file '%s'" % (db, table, dumpFileName))
def dbColumns(self, dbColumnsDict, colConsider, dbs): def dbColumns(self, dbColumnsDict, colConsider, dbs):
for column in dbColumnsDict.keys(): for column in dbColumnsDict.keys():

View File

@ -23,7 +23,9 @@ except (ImportError, OSError):
else: else:
_multiprocessing = multiprocessing _multiprocessing = multiprocessing
import os
import re import re
import tempfile
import time import time
from hashlib import md5 from hashlib import md5
@ -549,6 +551,7 @@ def dictionaryAttack(attack_dict):
results = [] results = []
resumes = [] resumes = []
processException = False processException = False
user_hash = []
for (_, hashes) in attack_dict.items(): for (_, hashes) in attack_dict.items():
for hash_ in hashes: for hash_ in hashes:
@ -597,6 +600,7 @@ def dictionaryAttack(attack_dict):
resumed = hashDBRetrieve(hash_) resumed = hashDBRetrieve(hash_)
if not resumed: if not resumed:
attack_info.append(item) attack_info.append(item)
user_hash.append(item[0])
else: else:
infoMsg = "resuming password '%s' for hash '%s'" % (resumed, hash_) infoMsg = "resuming password '%s' for hash '%s'" % (resumed, hash_)
if user and not user.startswith(DUMMY_USER_PREFIX): if user and not user.startswith(DUMMY_USER_PREFIX):
@ -817,6 +821,21 @@ def dictionaryAttack(attack_dict):
results.extend(resumes) results.extend(resumes)
fp = None
for user, hash_ in user_hash:
if not any(_[1] == hash_ for _ in results):
if fp is None:
handle, filename = tempfile.mkstemp(suffix=".txt")
os.close(handle)
fp = open(filename, "w+")
singleTimeLogMessage("writing uncracked hashes to '%s' for eventual further processing" % filename)
if user and not user.startswith(DUMMY_USER_PREFIX):
fp.write("%s:%s\n" % (user, hash_))
else:
fp.write("%s\n" % hash_)
if fp:
fp.close()
if len(hash_regexes) == 0: if len(hash_regexes) == 0:
warnMsg = "unknown hash format. " warnMsg = "unknown hash format. "
warnMsg += "Please report by e-mail to %s" % ML warnMsg += "Please report by e-mail to %s" % ML