minor update

This commit is contained in:
Miroslav Stampar 2011-01-03 08:46:20 +00:00
parent 8625494ff2
commit d19a8d53e4
2 changed files with 20 additions and 3 deletions

View File

@ -497,11 +497,11 @@ def simpletonCheckSqlInjection(place, parameter, value):
firstPage, _ = Request.queryPage(payload, place, content=True, raise404=False) firstPage, _ = Request.queryPage(payload, place, content=True, raise404=False)
if not (wasLastRequestDBMSError() or wasLastRequestHTTPError()): if not (wasLastRequestDBMSError() or wasLastRequestHTTPError()):
if getComparePageRatio(kb.originalPage, firstPage) > CONSTANT_RATIO: if getComparePageRatio(kb.originalPage, firstPage, filtered=True) > CONSTANT_RATIO:
payload = "%s AND %d>%d" % (value, randInt, randInt+1) payload = "%s AND %d>%d" % (value, randInt, randInt+1)
payload = agent.payload(place, parameter, value, payload) payload = agent.payload(place, parameter, value, payload)
secondPage, _ = Request.queryPage(payload, place, content=True, raise404=False) secondPage, _ = Request.queryPage(payload, place, content=True, raise404=False)
result = getComparePageRatio(firstPage, secondPage) <= CONSTANT_RATIO result = getComparePageRatio(firstPage, secondPage, filtered=True) <= CONSTANT_RATIO
infoMsg = "simpleton test shows that %s " % place infoMsg = "simpleton test shows that %s " % place
infoMsg += "parameter '%s' might " % parameter infoMsg += "parameter '%s' might " % parameter

View File

@ -1954,9 +1954,17 @@ def unicodeToSafeHTMLValue(value):
return retVal return retVal
def getErrorParsedDBMSes(): def getErrorParsedDBMSes():
"""
Returns array with parsed DBMS
names till now
"""
return kb.htmlFp return kb.htmlFp
def showHttpErrorCodes(): def showHttpErrorCodes():
"""
Shows all HTTP error codes
raised till now
"""
if kb.httpErrorCodes: if kb.httpErrorCodes:
warnMsg = "HTTP error codes detected during testing:\n" warnMsg = "HTTP error codes detected during testing:\n"
warnMsg += ", ".join("%d (%s) - %d times" % (code, httplib.responses[code]\ warnMsg += ", ".join("%d (%s) - %d times" % (code, httplib.responses[code]\
@ -1964,7 +1972,16 @@ def showHttpErrorCodes():
for code, count in kb.httpErrorCodes.items()) for code, count in kb.httpErrorCodes.items())
logger.warn(warnMsg) logger.warn(warnMsg)
def getComparePageRatio(firstPage, secondPage): def getComparePageRatio(firstPage, secondPage, filtered=False):
"""
Returns comparison ratio between
two given pages
"""
if filtered:
firstPage = getFilteredPageContent(firstPage)
secondPage = getFilteredPageContent(secondPage)
conf.seqMatcher.set_seq1(firstPage) conf.seqMatcher.set_seq1(firstPage)
conf.seqMatcher.set_seq2(secondPage) conf.seqMatcher.set_seq2(secondPage)
return conf.seqMatcher.quick_ratio() return conf.seqMatcher.quick_ratio()