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

Skip to content

Commit 6cd780e

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents 7c7b608 + 33094a1 commit 6cd780e

3 files changed

Lines changed: 18 additions & 21 deletions

File tree

lib/controller/checks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,11 @@ def genCmpPayload():
360360
kb.matchRatio = None
361361
kb.negativeLogic = (where == PAYLOAD.WHERE.NEGATIVE)
362362
Request.queryPage(genCmpPayload(), place, raise404=False)
363-
falsePage = threadData.lastComparisonPage or ""
363+
falseContent = threadData.lastComparisonContent
364364

365365
# Perform the test's True request
366366
trueResult = Request.queryPage(reqPayload, place, raise404=False)
367-
truePage = threadData.lastComparisonPage or ""
367+
trueContent = threadData.lastComparisonContent
368368

369369
if trueResult:
370370
falseResult = Request.queryPage(genCmpPayload(), place, raise404=False)
@@ -377,11 +377,11 @@ def genCmpPayload():
377377
injectable = True
378378

379379
if not injectable and not any((conf.string, conf.notString, conf.regexp)) and kb.pageStable:
380-
trueSet = set(extractTextTagContent(truePage))
381-
falseSet = set(extractTextTagContent(falsePage))
382-
candidates = filter(None, (_.strip() if _.strip() in (kb.pageTemplate or "") and _.strip() not in falsePage else None for _ in (trueSet - falseSet)))
380+
trueSet = set(extractTextTagContent(trueContent))
381+
falseSet = set(extractTextTagContent(falseContent))
382+
candidates = filter(None, (_.strip() if _.strip() in (kb.pageTemplate or "") and _.strip() not in falseContent else None for _ in (trueSet - falseSet)))
383383
if candidates:
384-
conf.string = random.sample(candidates, 1)[0]
384+
conf.string = candidates[0]
385385
infoMsg = "%s parameter '%s' seems to be '%s' injectable (with --string=\"%s\")" % (place, parameter, title, repr(conf.string).lstrip('u').strip("'"))
386386
logger.info(infoMsg)
387387

lib/core/threads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def reset(self):
4141
self.disableStdOut = False
4242
self.hashDBCursor = None
4343
self.inTransaction = False
44-
self.lastComparisonPage = None
44+
self.lastComparisonContent = None
4545
self.lastErrorPage = None
4646
self.lastHTTPError = None
4747
self.lastRedirectMsg = None

lib/request/comparison.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,26 @@ def _adjust(condition, getRatioValue):
4646
def _comparison(page, headers, code, getRatioValue, pageLength):
4747
threadData = getCurrentThreadData()
4848

49-
if kb.testMode:
50-
threadData.lastComparisonPage = page
49+
if kb.testMode or any((conf.string, conf.notString, conf.regexp)):
50+
threadData.lastComparisonContent = "%s%s" % (listToStrValue(headers.headers if headers else ""), page or "")
5151

5252
if page is None and pageLength is None:
5353
return None
5454

5555
seqMatcher = threadData.seqMatcher
5656
seqMatcher.set_seq1(kb.pageTemplate)
5757

58-
if any((conf.string, conf.notString, conf.regexp)):
59-
rawResponse = "%s%s" % (listToStrValue(headers.headers if headers else ""), page)
58+
# String to match in page when the query is True and/or valid
59+
if conf.string:
60+
return conf.string in threadData.lastComparisonContent
6061

61-
# String to match in page when the query is True and/or valid
62-
if conf.string:
63-
return conf.string in rawResponse
62+
# String to match in page when the query is False and/or invalid
63+
if conf.notString:
64+
return conf.notString not in threadData.lastComparisonContent
6465

65-
# String to match in page when the query is False and/or invalid
66-
if conf.notString:
67-
return conf.notString not in rawResponse
68-
69-
# Regular expression to match in page when the query is True and/or valid
70-
if conf.regexp:
71-
return re.search(conf.regexp, rawResponse, re.I | re.M) is not None
66+
# Regular expression to match in page when the query is True and/or valid
67+
if conf.regexp:
68+
return re.search(conf.regexp, threadData.lastComparisonContent, re.I | re.M) is not None
7269

7370
# HTTP code to match when the query is valid
7471
if conf.code:

0 commit comments

Comments
 (0)