File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed
Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -1867,6 +1867,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
18671867 kb .cache .content = {}
18681868 kb .cache .encoding = {}
18691869 kb .cache .alphaBoundaries = None
1870+ kb .cache .hashRegex = None
18701871 kb .cache .intBoundaries = None
18711872 kb .cache .parsedDbms = {}
18721873 kb .cache .regex = {}
Original file line number Diff line number Diff line change 1818from thirdparty .six import unichr as _unichr
1919
2020# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21- VERSION = "1.4.4.8 "
21+ VERSION = "1.4.4.9 "
2222TYPE = "dev" if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] != '0' else "stable"
2323TYPE_COLORS = {"dev" : 33 , "stable" : 90 , "pip" : 34 }
2424VERSION_STRING = "sqlmap/%s#%s" % ('.' .join (VERSION .split ('.' )[:- 1 ]) if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] == '0' else VERSION , TYPE )
Original file line number Diff line number Diff line change @@ -741,17 +741,26 @@ def hashRecognition(value):
741741 if value and len (value ) >= 8 and ' ' not in value : # Note: pre-filter condition (for optimization purposes)
742742 isOracle , isMySQL = Backend .isDbms (DBMS .ORACLE ), Backend .isDbms (DBMS .MYSQL )
743743
744- if isinstance (value , six .string_types ):
744+ if kb .cache .hashRegex is None :
745+ parts = []
746+
745747 for name , regex in getPublicTypeMembers (HASH ):
746748 # Hashes for Oracle and old MySQL look the same hence these checks
747749 if isOracle and regex == HASH .MYSQL_OLD or isMySQL and regex == HASH .ORACLE_OLD :
748750 continue
749751 elif regex == HASH .CRYPT_GENERIC :
750752 if any ((value .lower () == value , value .upper () == value )):
751753 continue
752- elif re .match (regex , value ):
753- retVal = regex
754- break
754+ else :
755+ parts .append ("(?P<%s>%s)" % (name , regex ))
756+
757+ kb .cache .hashRegex = ('|' .join (parts )).replace ("(?i)" , "" )
758+
759+ if isinstance (value , six .string_types ):
760+ match = re .search (kb .cache .hashRegex , value , re .I )
761+ if match :
762+ algorithm , _ = [_ for _ in match .groupdict ().items () if _ [1 ] is not None ][0 ]
763+ retVal = getattr (HASH , algorithm )
755764
756765 return retVal
757766
You can’t perform that action at this time.
0 commit comments