some more speed ups for hash cracking

This commit is contained in:
Miroslav Stampar 2011-11-02 09:57:42 +00:00
parent 2f355db230
commit ea125d820d
2 changed files with 22 additions and 8 deletions

View File

@ -630,10 +630,14 @@ def dictionaryAttack(attack_dict):
process.terminate() process.terminate()
process.join() process.join()
finally:
if retVal:
conf.hashDB.beginTransaction()
while not retVal.empty(): while not retVal.empty():
_, hash_, word = item = retVal.get(block=False) _, hash_, word = item = retVal.get(block=False)
conf.hashDB.write(hash_, word) conf.hashDB.write(hash_, word)
results.append(item) results.append(item)
conf.hashDB.endTransaction()
clearConsoleLine() clearConsoleLine()
@ -706,10 +710,14 @@ def dictionaryAttack(attack_dict):
process.terminate() process.terminate()
process.join() process.join()
finally:
if retVal:
conf.hashDB.beginTransaction()
while not retVal.empty(): while not retVal.empty():
_, hash_, word = item = retVal.get(block=False) _, hash_, word = item = retVal.get(block=False)
conf.hashDB.write(hash_, word) conf.hashDB.write(hash_, word)
results.append(item) results.append(item)
conf.hashDB.endTransaction()
clearConsoleLine() clearConsoleLine()

View File

@ -75,3 +75,9 @@ class HashDB(object):
raise raise
else: else:
break break
def beginTransaction(self):
self.cursor.execute('BEGIN TRANSACTION')
def endTransaction(self):
self.cursor.execute('END TRANSACTION')