now showing trimmed output in for of warning message (UNION and ERROR techniques affected)

This commit is contained in:
Miroslav Stampar 2011-04-20 12:41:58 +00:00
parent 7993f3f12d
commit 1286cc0913
2 changed files with 24 additions and 0 deletions

View File

@ -52,6 +52,8 @@ def __oneShotErrorUse(expression, field):
while True:
check = "%s(?P<result>.*?)%s" % (kb.misc.start, kb.misc.stop)
trimcheck = "%s(?P<result>.*?)</" % (kb.misc.start)
nulledCastedField = agent.nullAndCastField(field)
if Backend.getIdentifiedDbms() == DBMS.MYSQL:
@ -82,6 +84,18 @@ def __oneShotErrorUse(expression, field):
if output:
output = getUnicode(output, kb.pageEncoding)
else:
trimmed = extractRegexResult(trimcheck, page, re.DOTALL | re.IGNORECASE) \
or extractRegexResult(trimcheck, listToStrValue(headers.headers \
if headers else None), re.DOTALL | re.IGNORECASE) \
or extractRegexResult(trimcheck, threadData.lastRedirectMsg[1] \
if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == \
threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE)
if trimmed:
warnMsg = "trimmed output output detected: "
warnMsg += trimmed
logger.warn(warnMsg)
if isinstance(output, basestring):
output = htmlunescape(output).replace("<br>", "\n")

View File

@ -44,6 +44,7 @@ def __oneShotUnionUse(expression, unpack=True):
global reqCount
check = "(?P<result>%s.*%s)" % (kb.misc.start, kb.misc.stop)
trimcheck = "%s(?P<result>.*?)</" % (kb.misc.start)
# Prepare expression with delimiters
expression = agent.concatQuery(expression, unpack)
@ -72,6 +73,15 @@ def __oneShotUnionUse(expression, unpack=True):
if output:
output = getUnicode(output, kb.pageEncoding)
else:
trimmed = extractRegexResult(trimcheck, removeReflectiveValues(page, payload), re.DOTALL | re.IGNORECASE) \
or extractRegexResult(trimcheck, removeReflectiveValues(listToStrValue(headers.headers \
if headers else None), payload, True), re.DOTALL | re.IGNORECASE)
if trimmed:
warnMsg = "trimmed output output detected: "
warnMsg += trimmed
logger.warn(warnMsg)
return output