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: