mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-09 08:00:36 +03:00
More explicit function name also getRatioValue parameter has nothing to do with comparison at this stage as far as I can see (that might have fixed another "bug", to be checked later)
This commit is contained in:
parent
4520744b4d
commit
cc15373769
|
@ -35,24 +35,23 @@ def comparison(page, headers, code=None, getRatioValue=False, pageLength=None):
|
||||||
seqMatcher = getCurrentThreadData().seqMatcher
|
seqMatcher = getCurrentThreadData().seqMatcher
|
||||||
seqMatcher.set_seq1(kb.pageTemplate)
|
seqMatcher.set_seq1(kb.pageTemplate)
|
||||||
|
|
||||||
def _(condition):
|
def checkNegativeLogic(condition):
|
||||||
condition = not condition if kb.negativeLogic else condition
|
return 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]):
|
if any([conf.string, conf.regexp]):
|
||||||
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
|
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
|
||||||
|
|
||||||
# String to match in page when the query is valid
|
# String to match in page when the query is valid
|
||||||
if conf.string:
|
if conf.string:
|
||||||
return _(conf.string in rawResponse)
|
return checkNegativeLogic(conf.string in rawResponse)
|
||||||
|
|
||||||
# Regular expression to match in page when the query is valid
|
# Regular expression to match in page when the query is valid
|
||||||
if conf.regexp:
|
if conf.regexp:
|
||||||
return _(re.search(conf.regexp, rawResponse, re.I | re.M) is not None)
|
return checkNegativeLogic(re.search(conf.regexp, rawResponse, re.I | re.M) is not None)
|
||||||
|
|
||||||
# HTTP code to match when the query is valid
|
# HTTP code to match when the query is valid
|
||||||
if isinstance(code, int) and conf.code:
|
if isinstance(code, int) and conf.code:
|
||||||
return _(conf.code == code)
|
return checkNegativeLogic(conf.code == code)
|
||||||
|
|
||||||
if page:
|
if page:
|
||||||
# In case of an DBMS error page return None
|
# In case of an DBMS error page return None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user