minor code refactoring

This commit is contained in:
Miroslav Stampar 2011-01-14 14:55:59 +00:00
parent fb9d7cdfaa
commit 08f7e20c51
3 changed files with 18 additions and 15 deletions

View File

@ -422,12 +422,11 @@ def checkSqlInjection(place, parameter, value):
injection.data[stype].vector = vector injection.data[stype].vector = vector
injection.data[stype].comment = comment injection.data[stype].comment = comment
injection.data[stype].templatePayload = templatePayload injection.data[stype].templatePayload = templatePayload
injection.data[stype].matchRatio = kb.matchRatio
injection.data[stype].conf = advancedDict() injection.conf.textOnly = conf.textOnly
injection.data[stype].conf.matchRatio = kb.matchRatio injection.conf.string = conf.string
injection.data[stype].conf.textOnly = conf.textOnly injection.conf.regexp = conf.regexp
injection.data[stype].conf.string = conf.string
injection.data[stype].conf.regexp = conf.regexp
if hasattr(test, "details"): if hasattr(test, "details"):
for detailKey, detailValue in test.details.items(): for detailKey, detailValue in test.details.items():

View File

@ -1943,19 +1943,20 @@ def initTechnique(technique=None):
if data: if data:
kb.pageTemplate, kb.errorIsNone = getPageTemplate(data.templatePayload, kb.injection.place) kb.pageTemplate, kb.errorIsNone = getPageTemplate(data.templatePayload, kb.injection.place)
kb.matchRatio = data.matchRatio
kb.matchRatio = data.conf.matchRatio # Restoring stored conf options
if data.conf.textOnly: if kb.injection.conf.textOnly:
conf.textOnly = True conf.textOnly = True
debugMsg = "restoring switch --text-only" debugMsg = "restoring switch --text-only"
logger.debug(debugMsg) logger.debug(debugMsg)
if data.conf.string: if kb.injection.conf.string:
conf.string = data.conf.string conf.string = kb.injection.conf.string
debugMsg = "restoring option --string '%s'" % data.conf.string debugMsg = "restoring option --string '%s'" % conf.string
logger.debug(debugMsg) logger.debug(debugMsg)
if data.conf.regexp: if kb.injection.conf.regexp:
conf.regexp = data.conf.regexp conf.regexp = kb.injection.conf.regexp
debugMsg = "restoring option --regexp '%s'" % data.conf.regexp debugMsg = "restoring option --regexp '%s'" % conf.regexp
logger.debug(debugMsg) logger.debug(debugMsg)
else: else:
warnMsg = "there is no injection data available for technique " warnMsg = "there is no injection data available for technique "
@ -2086,8 +2087,7 @@ def getComparePageRatio(firstPage, secondPage, filtered=False):
""" """
if filtered: if filtered:
firstPage = getFilteredPageContent(firstPage) (firstPage, secondPage) = map(getFilteredPageContent, (firstPage, secondPage))
secondPage = getFilteredPageContent(secondPage)
conf.seqMatcher.set_seq1(firstPage) conf.seqMatcher.set_seq1(firstPage)
conf.seqMatcher.set_seq2(secondPage) conf.seqMatcher.set_seq2(secondPage)

View File

@ -77,6 +77,10 @@ class injectionDict(advancedDict):
# title, where, comment and reqPayload # title, where, comment and reqPayload
self.data = advancedDict() self.data = advancedDict()
# conf is a dict with stores current snapshot of important
# options used during detection
self.conf = advancedDict()
self.dbms = None self.dbms = None
self.dbms_version = None self.dbms_version = None
self.os = None self.os = None