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

Skip to content

Commit d4b5133

Browse files
committed
Update for an Issue #272
1 parent a14697e commit d4b5133

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/utils/hash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
from lib.core.settings import IS_WIN
6262
from lib.core.settings import ITOA64
6363
from lib.core.settings import ML
64+
from lib.core.settings import NULL
6465
from lib.core.settings import UNICODE_ENCODING
6566
from lib.core.settings import ROTATING_CHARS
6667
from lib.core.wordlist import Wordlist
@@ -314,14 +315,15 @@ def storeHashesToFile(attack_dict):
314315
with open(filename, "w+") as f:
315316
for user, hashes in attack_dict.items():
316317
for hash_ in hashes:
318+
if not hash_ or hash_ == NULL or not hashRecognition(hash_):
319+
continue
317320
if user and not user.startswith(DUMMY_USER_PREFIX):
318321
f.write("%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING)))
319322
else:
320323
f.write("%s\n" % hash_.encode(UNICODE_ENCODING))
321324

322325
def attackCachedUsersPasswords():
323326
if kb.data.cachedUsersPasswords:
324-
storeHashesToFile(kb.data.cachedUsersPasswords)
325327
results = dictionaryAttack(kb.data.cachedUsersPasswords)
326328

327329
for (_, hash_, password) in results:

plugins/generic/users.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from lib.core.threads import getCurrentThreadData
4141
from lib.request import inject
4242
from lib.utils.hash import attackCachedUsersPasswords
43+
from lib.utils.hash import storeHashesToFile
4344
from lib.utils.pivotdumptable import pivotDumpTable
4445

4546
class Users:
@@ -300,6 +301,8 @@ def getPasswordHashes(self):
300301
for user in kb.data.cachedUsersPasswords:
301302
kb.data.cachedUsersPasswords[user] = list(set(kb.data.cachedUsersPasswords[user]))
302303

304+
storeHashesToFile(kb.data.cachedUsersPasswords)
305+
303306
message = "do you want to perform a dictionary-based attack "
304307
message += "against retrieved password hashes? [Y/n/q]"
305308
test = readInput(message, default="Y")

0 commit comments

Comments
 (0)