@@ -146,8 +146,7 @@ def checkSqlInjection(place, parameter, value):
146146 # error message, simple heuristic check or via DBMS-specific
147147 # payload), ask the user to limit the tests to the fingerprinted
148148 # DBMS
149- if kb .reduceTests is None and not conf .testFilter and (intersect (Backend .getErrorParsedDBMSes (), \
150- SUPPORTED_DBMS , True ) or kb .heuristicDbms or injection .dbms ):
149+ if kb .reduceTests is None and not conf .testFilter and (intersect (Backend .getErrorParsedDBMSes (), SUPPORTED_DBMS , True ) or kb .heuristicDbms or injection .dbms ):
151150 msg = "it looks like the back-end DBMS is '%s'. " % (Format .getErrorParsedDBMSes () or kb .heuristicDbms or injection .dbms )
152151 msg += "Do you want to skip test payloads specific for other DBMSes? [Y/n]"
153152 kb .reduceTests = (Backend .getErrorParsedDBMSes () or [kb .heuristicDbms ]) if readInput (msg , default = 'Y' , boolean = True ) else []
@@ -156,9 +155,7 @@ def checkSqlInjection(place, parameter, value):
156155 # message, via simple heuristic check or via DBMS-specific
157156 # payload), ask the user to extend the tests to all DBMS-specific,
158157 # regardless of --level and --risk values provided
159- if kb .extendTests is None and not conf .testFilter and (conf .level < 5 or conf .risk < 3 ) \
160- and (intersect (Backend .getErrorParsedDBMSes (), SUPPORTED_DBMS , True ) or \
161- kb .heuristicDbms or injection .dbms ):
158+ if kb .extendTests is None and not conf .testFilter and (conf .level < 5 or conf .risk < 3 ) and (intersect (Backend .getErrorParsedDBMSes (), SUPPORTED_DBMS , True ) or kb .heuristicDbms or injection .dbms ):
162159 msg = "for the remaining tests, do you want to include all tests "
163160 msg += "for '%s' extending provided " % (Format .getErrorParsedDBMSes () or kb .heuristicDbms or injection .dbms )
164161 msg += "level (%d)" % conf .level if conf .level < 5 else ""
@@ -242,19 +239,15 @@ def checkSqlInjection(place, parameter, value):
242239
243240 # Skip tests if title, vector or DBMS is not included by the
244241 # given test filter
245- if conf .testFilter and not any (conf .testFilter in str (item ) or \
246- re .search (conf .testFilter , str (item ), re .I ) for item in \
247- (test .title , test .vector , payloadDbms )):
242+ if conf .testFilter and not any (conf .testFilter in str (item ) or re .search (conf .testFilter , str (item ), re .I ) for item in (test .title , test .vector , payloadDbms )):
248243 debugMsg = "skipping test '%s' because its " % title
249244 debugMsg += "name/vector/DBMS is not included by the given filter"
250245 logger .debug (debugMsg )
251246 continue
252247
253248 # Skip tests if title, vector or DBMS is included by the
254249 # given skip filter
255- if conf .testSkip and any (conf .testSkip in str (item ) or \
256- re .search (conf .testSkip , str (item ), re .I ) for item in \
257- (test .title , test .vector , payloadDbms )):
250+ if conf .testSkip and any (conf .testSkip in str (item ) or re .search (conf .testSkip , str (item ), re .I ) for item in (test .title , test .vector , payloadDbms )):
258251 debugMsg = "skipping test '%s' because its " % title
259252 debugMsg += "name/vector/DBMS is included by the given skip filter"
260253 logger .debug (debugMsg )
@@ -588,10 +581,10 @@ def genCmpPayload():
588581 # body for the test's <grep> regular expression
589582 try :
590583 page , headers , _ = Request .queryPage (reqPayload , place , content = True , raise404 = False )
591- output = extractRegexResult (check , page , re .DOTALL | re .IGNORECASE ) \
592- or extractRegexResult (check , threadData .lastHTTPError [2 ] if wasLastResponseHTTPError () else None , re .DOTALL | re .IGNORECASE ) \
593- or extractRegexResult (check , listToStrValue ((headers [key ] for key in headers .keys () if key .lower () != URI_HTTP_HEADER .lower ()) if headers else None ), re .DOTALL | re .IGNORECASE ) \
594- or extractRegexResult (check , threadData .lastRedirectMsg [1 ] if threadData .lastRedirectMsg and threadData .lastRedirectMsg [0 ] == threadData .lastRequestUID else None , re .DOTALL | re .IGNORECASE )
584+ output = extractRegexResult (check , page , re .DOTALL | re .IGNORECASE )
585+ output = output or extractRegexResult (check , threadData .lastHTTPError [2 ] if wasLastResponseHTTPError () else None , re .DOTALL | re .IGNORECASE )
586+ output = output or extractRegexResult (check , listToStrValue ((headers [key ] for key in headers .keys () if key .lower () != URI_HTTP_HEADER .lower ()) if headers else None ), re .DOTALL | re .IGNORECASE )
587+ output = output or extractRegexResult (check , threadData .lastRedirectMsg [1 ] if threadData .lastRedirectMsg and threadData .lastRedirectMsg [0 ] == threadData .lastRequestUID else None , re .DOTALL | re .IGNORECASE )
595588
596589 if output :
597590 result = output == "1"
@@ -873,8 +866,7 @@ def checkFalsePositives(injection):
873866
874867 retVal = True
875868
876- if all (_ in (PAYLOAD .TECHNIQUE .BOOLEAN , PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED ) for _ in injection .data ) or \
877- (len (injection .data ) == 1 and PAYLOAD .TECHNIQUE .UNION in injection .data and "Generic" in injection .data [PAYLOAD .TECHNIQUE .UNION ].title ):
869+ if all (_ in (PAYLOAD .TECHNIQUE .BOOLEAN , PAYLOAD .TECHNIQUE .TIME , PAYLOAD .TECHNIQUE .STACKED ) for _ in injection .data ) or (len (injection .data ) == 1 and PAYLOAD .TECHNIQUE .UNION in injection .data and "Generic" in injection .data [PAYLOAD .TECHNIQUE .UNION ].title ):
878870 pushValue (kb .injection )
879871
880872 infoMsg = "checking if the injection point on %s " % injection .place
@@ -971,7 +963,7 @@ def checkFilteredChars(injection):
971963
972964 # inference techniques depend on character '>'
973965 if not any (_ in injection .data for _ in (PAYLOAD .TECHNIQUE .ERROR , PAYLOAD .TECHNIQUE .UNION , PAYLOAD .TECHNIQUE .QUERY )):
974- if not checkBooleanExpression ("%d>%d" % (randInt + 1 , randInt )):
966+ if not checkBooleanExpression ("%d>%d" % (randInt + 1 , randInt )):
975967 warnMsg = "it appears that the character '>' is "
976968 warnMsg += "filtered by the back-end server. You are strongly "
977969 warnMsg += "advised to rerun with the '--tamper=between'"
0 commit comments