@@ -703,20 +703,19 @@ def attackDumpedTable():
703703def hashRecognition (value ):
704704 retVal = None
705705
706- if six .PY2 : # currently only supported on Python2
707- isOracle , isMySQL = Backend .isDbms (DBMS .ORACLE ), Backend .isDbms (DBMS .MYSQL )
706+ isOracle , isMySQL = Backend .isDbms (DBMS .ORACLE ), Backend .isDbms (DBMS .MYSQL )
708707
709- if isinstance (value , six .string_types ):
710- for name , regex in getPublicTypeMembers (HASH ):
711- # Hashes for Oracle and old MySQL look the same hence these checks
712- if isOracle and regex == HASH .MYSQL_OLD or isMySQL and regex == HASH .ORACLE_OLD :
708+ if isinstance (value , six .string_types ):
709+ for name , regex in getPublicTypeMembers (HASH ):
710+ # Hashes for Oracle and old MySQL look the same hence these checks
711+ if isOracle and regex == HASH .MYSQL_OLD or isMySQL and regex == HASH .ORACLE_OLD :
712+ continue
713+ elif regex == HASH .CRYPT_GENERIC :
714+ if any ((value .lower () == value , value .upper () == value )):
713715 continue
714- elif regex == HASH .CRYPT_GENERIC :
715- if any ((value .lower () == value , value .upper () == value )):
716- continue
717- elif re .match (regex , value ):
718- retVal = regex
719- break
716+ elif re .match (regex , value ):
717+ retVal = regex
718+ break
720719
721720 return retVal
722721
@@ -737,7 +736,9 @@ def _bruteProcessVariantA(attack_info, hash_regex, suffix, retVal, proc_id, proc
737736
738737 count += 1
739738
740- if not isinstance (word , six .string_types ):
739+ if isinstance (word , six .binary_type ):
740+ word = getUnicode (word )
741+ elif not isinstance (word , six .string_types ):
741742 continue
742743
743744 if suffix :
@@ -812,7 +813,9 @@ def _bruteProcessVariantB(user, hash_, kwargs, hash_regex, suffix, retVal, found
812813
813814 count += 1
814815
815- if not isinstance (word , six .string_types ):
816+ if isinstance (word , six .binary_type ):
817+ word = getUnicode (word )
818+ elif not isinstance (word , six .string_types ):
816819 continue
817820
818821 if suffix :
0 commit comments