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

Skip to content

Commit 9c1d1ca

Browse files
committed
minor update
1 parent 2a72c1a commit 9c1d1ca

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

lib/utils/hash.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -484,20 +484,21 @@ def dictionaryAttack(attack_dict):
484484
hash_ = hash_.split()[0].lower()
485485

486486
if getCompiledRegex(hash_regex).match(hash_):
487-
if hash_regex in (HASH.MYSQL, HASH.MYSQL_OLD, HASH.MD5_GENERIC, HASH.SHA1_GENERIC):
488-
attack_info.append([(user, hash_), {}])
487+
item = None
489488

489+
if hash_regex in (HASH.MYSQL, HASH.MYSQL_OLD, HASH.MD5_GENERIC, HASH.SHA1_GENERIC):
490+
item = [(user, hash_), {}]
490491
elif hash_regex in (HASH.ORACLE_OLD, HASH.POSTGRES):
491-
attack_info.append([(user, hash_), {'username': user}])
492-
492+
item = [(user, hash_), {'username': user}]
493493
elif hash_regex in (HASH.ORACLE):
494-
attack_info.append([(user, hash_), {'salt': hash_[-20:]}])
495-
494+
item = [(user, hash_), {'salt': hash_[-20:]}]
496495
elif hash_regex in (HASH.MSSQL, HASH.MSSQL_OLD):
497-
attack_info.append([(user, hash_), {'salt': hash_[6:14]}])
498-
496+
item = [(user, hash_), {'salt': hash_[6:14]}]
499497
elif hash_regex in (HASH.CRYPT_GENERIC):
500-
attack_info.append([(user, hash_), {'salt': hash_[0:2]}])
498+
item = [(user, hash_), {'salt': hash_[0:2]}]
499+
500+
if item and item not in attack_info:
501+
attack_info.append(item)
501502

502503
if not attack_info:
503504
continue

0 commit comments

Comments
 (0)