diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 2c4272323..7a1d14832 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -21,6 +21,7 @@ from lib.core.common import randomInt from lib.core.common import randomStr from lib.core.common import readInput from lib.core.common import showStaticWords +from lib.core.common import wasLastRequestError from lib.core.common import DynamicContentItem from lib.core.convert import urlencode from lib.core.data import conf @@ -103,7 +104,7 @@ def heuristicCheckSqlInjection(place, parameter, value): payload = conf.paramDict[place][parameter].replace('*', payload) Request.queryPage(payload, place) - result = kb.lastErrorPage and kb.lastErrorPage[0]==kb.lastRequestUID + result = wasLastRequestError() infoMsg = "(error based) heuristics shows that %s " % place infoMsg += "parameter '%s' is " % parameter diff --git a/lib/core/common.py b/lib/core/common.py index 8d3eae7fe..0eae435a5 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1479,7 +1479,19 @@ def commonFinderOnly(initial, sequence): return longestCommonPrefix(*filter(lambda x: x.startswith(initial), sequence)) def pushValue(value): + """ + Push value to the stack + """ kb.valueStack.append(value) def popValue(): + """ + Pop value from the stack + """ return kb.valueStack.pop() + +def wasLastRequestError(): + """ + Returns True if the last web request resulted in a (recognized) DBMS error page + """ + return kb.lastErrorPage and kb.lastErrorPage[0]==kb.lastRequestUID diff --git a/lib/core/option.py b/lib/core/option.py index 0f4f9f188..521d22143 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1006,7 +1006,6 @@ def __setConfAttributes(): conf.dbmsConnector = None conf.dbmsHandler = None conf.dumpPath = None - conf.errorComparison = True conf.minMatchBlock = 8 conf.dynMarkLength = 32 conf.httpHeaders = [] diff --git a/lib/request/comparison.py b/lib/request/comparison.py index afc9330c1..9e9fe449f 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -11,6 +11,7 @@ import re from lib.core.common import getFilteredPageContent from lib.core.common import preparePageForLineComparison +from lib.core.common import wasLastRequestError from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger @@ -94,7 +95,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): return ratio # In case of an DBMS error page return False - elif conf.errorComparison and kb.lastErrorPage and kb.lastErrorPage[0]==kb.lastRequestUID: + elif wasLastRequestError(): return False # If the url is not stable it returns sequence matcher between the