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

Skip to content

Commit 08f7e20

Browse files
committed
minor code refactoring
1 parent fb9d7cd commit 08f7e20

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

lib/controller/checks.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,11 @@ def checkSqlInjection(place, parameter, value):
422422
injection.data[stype].vector = vector
423423
injection.data[stype].comment = comment
424424
injection.data[stype].templatePayload = templatePayload
425+
injection.data[stype].matchRatio = kb.matchRatio
425426

426-
injection.data[stype].conf = advancedDict()
427-
injection.data[stype].conf.matchRatio = kb.matchRatio
428-
injection.data[stype].conf.textOnly = conf.textOnly
429-
injection.data[stype].conf.string = conf.string
430-
injection.data[stype].conf.regexp = conf.regexp
427+
injection.conf.textOnly = conf.textOnly
428+
injection.conf.string = conf.string
429+
injection.conf.regexp = conf.regexp
431430

432431
if hasattr(test, "details"):
433432
for detailKey, detailValue in test.details.items():

lib/core/common.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,19 +1943,20 @@ def initTechnique(technique=None):
19431943

19441944
if data:
19451945
kb.pageTemplate, kb.errorIsNone = getPageTemplate(data.templatePayload, kb.injection.place)
1946+
kb.matchRatio = data.matchRatio
19461947

1947-
kb.matchRatio = data.conf.matchRatio
1948-
if data.conf.textOnly:
1948+
# Restoring stored conf options
1949+
if kb.injection.conf.textOnly:
19491950
conf.textOnly = True
19501951
debugMsg = "restoring switch --text-only"
19511952
logger.debug(debugMsg)
1952-
if data.conf.string:
1953-
conf.string = data.conf.string
1954-
debugMsg = "restoring option --string '%s'" % data.conf.string
1953+
if kb.injection.conf.string:
1954+
conf.string = kb.injection.conf.string
1955+
debugMsg = "restoring option --string '%s'" % conf.string
19551956
logger.debug(debugMsg)
1956-
if data.conf.regexp:
1957-
conf.regexp = data.conf.regexp
1958-
debugMsg = "restoring option --regexp '%s'" % data.conf.regexp
1957+
if kb.injection.conf.regexp:
1958+
conf.regexp = kb.injection.conf.regexp
1959+
debugMsg = "restoring option --regexp '%s'" % conf.regexp
19591960
logger.debug(debugMsg)
19601961
else:
19611962
warnMsg = "there is no injection data available for technique "
@@ -2086,8 +2087,7 @@ def getComparePageRatio(firstPage, secondPage, filtered=False):
20862087
"""
20872088

20882089
if filtered:
2089-
firstPage = getFilteredPageContent(firstPage)
2090-
secondPage = getFilteredPageContent(secondPage)
2090+
(firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage))
20912091

20922092
conf.seqMatcher.set_seq1(firstPage)
20932093
conf.seqMatcher.set_seq2(secondPage)

lib/core/datatype.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def __init__(self):
7777
# title, where, comment and reqPayload
7878
self.data = advancedDict()
7979

80+
# conf is a dict with stores current snapshot of important
81+
# options used during detection
82+
self.conf = advancedDict()
83+
8084
self.dbms = None
8185
self.dbms_version = None
8286
self.os = None

0 commit comments

Comments
 (0)