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

Skip to content

Commit fef60d5

Browse files
committed
some fixes :)
1 parent 1cc99e2 commit fef60d5

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

lib/controller/checks.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def checkSqlInjection(place, parameter, value, parenthesis):
6363
postfix = conf.postfix
6464

6565
for case in kb.injections.root.case:
66+
conf.matchRatio = None
67+
6668
positive = case.test.positive
6769
negative = case.test.negative
6870

@@ -73,12 +75,22 @@ def checkSqlInjection(place, parameter, value, parenthesis):
7375
infoMsg += "on %s parameter '%s'" % (place, parameter)
7476
logger.info(infoMsg)
7577

78+
payload = agent.payload(place, parameter, value, negative.format % eval(negative.params))
79+
_ = Request.queryPage(payload, place)
80+
7681
payload = agent.payload(place, parameter, value, positive.format % eval(positive.params))
7782
trueResult = Request.queryPage(payload, place)
7883

7984
if trueResult is True:
85+
infoMsg = "confirming %s (%s) injection " % (case.desc, logic)
86+
infoMsg += "on %s parameter '%s'" % (place, parameter)
87+
logger.info(infoMsg)
88+
8089
payload = agent.payload(place, parameter, value, negative.format % eval(negative.params))
8190

91+
randInt = randomInt()
92+
randStr = randomStr()
93+
8294
falseResult = Request.queryPage(payload, place)
8395

8496
if falseResult is False:

lib/controller/controller.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ def start():
254254
if testSqlInj:
255255
heuristicCheckSqlInjection(place, parameter, value)
256256

257-
conf.matchRatio = None
258-
259257
for parenthesis in range(0, 4):
260258
logMsg = "testing sql injection on %s " % place
261259
logMsg += "parameter '%s' with " % parameter

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
DESCRIPTION = "automatic SQL injection and database takeover tool"
2222
SITE = "http://sqlmap.sourceforge.net"
2323

24+
# minimum distance of ratio from conf.matchRatio to result in True
25+
ETA = 0.05
26+
2427
# sqlmap logger
2528
logging.addLevelName(9, "PAYLOAD")
2629
logging.addLevelName(8, "TRAFFIC OUT")

lib/request/comparison.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from lib.core.data import conf
1616
from lib.core.data import kb
1717
from lib.core.data import logger
18+
from lib.core.settings import ETA
1819

1920
def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
2021
if page is None and pageLength is None:
@@ -97,7 +98,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
9798
conf.matchRatio = conf.thold
9899

99100
elif kb.pageStable and ratio > 0.6 and ratio < 1:
100-
conf.matchRatio = min(ratio, 0.950)
101+
conf.matchRatio = ratio
101102
logger.debug("setting match ratio for current parameter to %.3f" % conf.matchRatio)
102103

103104
elif not kb.pageStable or ( kb.pageStable and ratio < 0.6 ):
@@ -115,4 +116,4 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
115116
# If the url is not stable it returns sequence matcher between the
116117
# first untouched HTTP response page content and this content
117118
else:
118-
return ratio > conf.matchRatio
119+
return (ratio - conf.matchRatio) > ETA

0 commit comments

Comments
 (0)