minor bug fix ("trimmed" error message was shown for empty cases too because u'' or None == None)

This commit is contained in:
Miroslav Stampar 2011-06-01 22:06:06 +00:00
parent 091c174bc4
commit fc96764f80
2 changed files with 14 additions and 10 deletions

View File

@ -85,14 +85,16 @@ def __oneShotErrorUse(expression, field):
# Parse the returned page to get the exact error-based # Parse the returned page to get the exact error-based
# sql injection output # sql injection output
output = extractRegexResult(check, page, re.DOTALL | re.IGNORECASE) \ output = reduce(lambda x, y: x if x is not None else y, [ \
or extractRegexResult(check, listToStrValue(headers.headers \ extractRegexResult(check, page, re.DOTALL | re.IGNORECASE), \
if headers else None), re.DOTALL | re.IGNORECASE) \ extractRegexResult(check, listToStrValue(headers.headers \
or extractRegexResult(check, threadData.lastRedirectMsg[1] \ if headers else None), re.DOTALL | re.IGNORECASE), \
extractRegexResult(check, threadData.lastRedirectMsg[1] \
if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == \ if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == \
threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE) threadData.lastRequestUID else None, re.DOTALL | re.IGNORECASE)], \
None)
if output: if output is not None:
output = getUnicode(output, kb.pageEncoding) output = getUnicode(output, kb.pageEncoding)
else: else:
trimmed = extractRegexResult(trimcheck, page, re.DOTALL | re.IGNORECASE) \ trimmed = extractRegexResult(trimcheck, page, re.DOTALL | re.IGNORECASE) \

View File

@ -75,11 +75,13 @@ def __oneShotUnionUse(expression, unpack=True):
# Parse the returned page to get the exact union-based # Parse the returned page to get the exact union-based
# sql injection output # sql injection output
output = extractRegexResult(check, removeReflectiveValues(page, payload), re.DOTALL | re.IGNORECASE) \ output = reduce(lambda x, y: x if x is not None else y, [ \
or extractRegexResult(check, removeReflectiveValues(listToStrValue(headers.headers \ extractRegexResult(check, removeReflectiveValues(page, payload), re.DOTALL | re.IGNORECASE), \
if headers else None), payload, True), re.DOTALL | re.IGNORECASE) extractRegexResult(check, removeReflectiveValues(listToStrValue(headers.headers \
if headers else None), payload, True), re.DOTALL | re.IGNORECASE)], \
None)
if output: if output is not None:
output = getUnicode(output, kb.pageEncoding) output = getUnicode(output, kb.pageEncoding)
else: else:
trimmed = extractRegexResult(trimcheck, removeReflectiveValues(page, payload), re.DOTALL | re.IGNORECASE) \ trimmed = extractRegexResult(trimcheck, removeReflectiveValues(page, payload), re.DOTALL | re.IGNORECASE) \