Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea125d8

Browse files
committed
some more speed ups for hash cracking
1 parent 2f355db commit ea125d8

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

lib/utils/hash.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,14 @@ def dictionaryAttack(attack_dict):
630630
process.terminate()
631631
process.join()
632632

633-
while not retVal.empty():
634-
_, hash_, word = item = retVal.get(block=False)
635-
conf.hashDB.write(hash_, word)
636-
results.append(item)
633+
finally:
634+
if retVal:
635+
conf.hashDB.beginTransaction()
636+
while not retVal.empty():
637+
_, hash_, word = item = retVal.get(block=False)
638+
conf.hashDB.write(hash_, word)
639+
results.append(item)
640+
conf.hashDB.endTransaction()
637641

638642
clearConsoleLine()
639643

@@ -706,10 +710,14 @@ class Value():
706710
process.terminate()
707711
process.join()
708712

709-
while not retVal.empty():
710-
_, hash_, word = item = retVal.get(block=False)
711-
conf.hashDB.write(hash_, word)
712-
results.append(item)
713+
finally:
714+
if retVal:
715+
conf.hashDB.beginTransaction()
716+
while not retVal.empty():
717+
_, hash_, word = item = retVal.get(block=False)
718+
conf.hashDB.write(hash_, word)
719+
results.append(item)
720+
conf.hashDB.endTransaction()
713721

714722
clearConsoleLine()
715723

lib/utils/hashdb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ def write(self, key, value):
7575
raise
7676
else:
7777
break
78+
79+
def beginTransaction(self):
80+
self.cursor.execute('BEGIN TRANSACTION')
81+
82+
def endTransaction(self):
83+
self.cursor.execute('END TRANSACTION')

0 commit comments

Comments
 (0)