mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
first step toward negative logic support
This commit is contained in:
@@ -35,21 +35,24 @@ def comparison(page, headers, code=None, getRatioValue=False, pageLength=None):
|
||||
seqMatcher = getCurrentThreadData().seqMatcher
|
||||
seqMatcher.set_seq1(kb.pageTemplate)
|
||||
|
||||
def _(condition):
|
||||
#condition = not condition if kb.negativeLogic else condition
|
||||
return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO)
|
||||
|
||||
if any([conf.string, conf.regexp]):
|
||||
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
|
||||
|
||||
# String to match in page when the query is valid
|
||||
if conf.string:
|
||||
condition = conf.string in rawResponse
|
||||
return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO)
|
||||
return _(conf.string in rawResponse)
|
||||
|
||||
# Regular expression to match in page when the query is valid
|
||||
if conf.regexp:
|
||||
condition = re.search(conf.regexp, rawResponse, re.I | re.M) is not None
|
||||
return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO)
|
||||
return _(re.search(conf.regexp, rawResponse, re.I | re.M) is not None)
|
||||
|
||||
# HTTP code to match when the query is valid
|
||||
if isinstance(code, int) and conf.code:
|
||||
return code == conf.code
|
||||
return _(conf.code == code)
|
||||
|
||||
if page:
|
||||
# In case of an DBMS error page return None
|
||||
|
||||
Reference in New Issue
Block a user