From 8138d1318e93635060f0b8f9ee0556378116f5c3 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 13 Feb 2013 15:10:31 +0100 Subject: [PATCH] Minor fix --- lib/utils/hash.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/utils/hash.py b/lib/utils/hash.py index 6358f9302..6d5ca49cf 100644 --- a/lib/utils/hash.py +++ b/lib/utils/hash.py @@ -317,18 +317,17 @@ def storeHashesToFile(attack_dict): with open(filename, "w+") as f: for user, hashes in attack_dict.items(): for hash_ in hashes: - if not hash_ or hash_ == NULL or not hashRecognition(hash_): - continue + hash_ = hash_.split()[0] if hash_ else hash_ + if hash_ and hash_ != NULL and hashRecognition(hash_): + item = None + if user and not user.startswith(DUMMY_USER_PREFIX): + item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING)) + else: + item = "%s\n" % hash_.encode(UNICODE_ENCODING) - item = None - if user and not user.startswith(DUMMY_USER_PREFIX): - item = "%s:%s\n" % (user.encode(UNICODE_ENCODING), hash_.encode(UNICODE_ENCODING)) - else: - item = "%s\n" % hash_.encode(UNICODE_ENCODING) - - if item and item not in items: - f.write(item) - items.add(item) + if item and item not in items: + f.write(item) + items.add(item) def attackCachedUsersPasswords(): if kb.data.cachedUsersPasswords: