Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce4c697

Browse files
committed
disabling "negative logic" as it's not half done (it was "luckily" working for --string/--regex/--code but it was a sheer luck); removing "dirty fix" from checks.py; proof that this was not ready for the release is that there was not check for negative logic anywhere for anything more then --string/--regex/--code
1 parent 772ead8 commit ce4c697

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

lib/controller/checks.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,6 @@ def genCmpPayload():
329329
kb.matchRatio = None
330330
Request.queryPage(genCmpPayload(), place, raise404=False)
331331

332-
# If in the comparing stage there was an error
333-
# then anything non-error will be considered as True
334-
if kb.errorIsNone and kb.matchRatio is None:
335-
kb.matchRatio = LOWER_RATIO_BOUND
336-
337332
# Perform the test's True request
338333
trueResult = Request.queryPage(reqPayload, place, raise404=False)
339334

lib/request/comparison.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,34 @@
2929
from lib.core.threads import getCurrentThreadData
3030

3131
def comparison(page, headers, code=None, getRatioValue=False, pageLength=None):
32+
#return _checkNegativeLogic(_comparison(page, headers, code, getRatioValue, pageLength), getRatioValue)
33+
return _comparison(page, headers, code, getRatioValue, pageLength)
34+
35+
def _checkNegativeLogic(condition, getRatioValue):
36+
condition = not (condition or False) if kb.negativeLogic else condition
37+
return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO)
38+
39+
def _comparison(page, headers, code, getRatioValue, pageLength):
3240
if page is None and pageLength is None:
3341
return None
3442

3543
seqMatcher = getCurrentThreadData().seqMatcher
3644
seqMatcher.set_seq1(kb.pageTemplate)
3745

38-
def checkNegativeLogic(condition):
39-
condition = not condition if kb.negativeLogic else condition
40-
return condition if not getRatioValue else (MAX_RATIO if condition else MIN_RATIO)
41-
4246
if any([conf.string, conf.regexp]):
4347
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
4448

4549
# String to match in page when the query is valid
4650
if conf.string:
47-
return checkNegativeLogic(conf.string in rawResponse)
51+
return conf.string in rawResponse
4852

4953
# Regular expression to match in page when the query is valid
5054
if conf.regexp:
51-
return checkNegativeLogic(re.search(conf.regexp, rawResponse, re.I | re.M) is not None)
55+
return re.search(conf.regexp, rawResponse, re.I | re.M) is not None
5256

5357
# HTTP code to match when the query is valid
5458
if isinstance(code, int) and conf.code:
55-
return checkNegativeLogic(conf.code == code)
59+
return conf.code == code
5660

5761
if page:
5862
# In case of an DBMS error page return None

0 commit comments

Comments
 (0)