diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 2b0b40974..cac433f54 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -52,6 +52,9 @@ def checkSqlInjection(place, parameter, value, parenthesis): randStr = randomStr() prefix = "" postfix = "" + retVal = None + + conf.matchRatio = None if conf.prefix or conf.postfix: if conf.prefix: @@ -87,9 +90,12 @@ def checkSqlInjection(place, parameter, value, parenthesis): if conf.beep: beep() - return case.name + retVal = case.name + break - return None + kb.paramMatchRatio[(place, parameter)] = conf.matchRatio + + return retVal def heuristicCheckSqlInjection(place, parameter, value): prefix = "" diff --git a/lib/controller/controller.py b/lib/controller/controller.py index c519baebc..2c5886914 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -30,6 +30,7 @@ from lib.core.exception import sqlmapNotVulnerableException from lib.core.exception import sqlmapSilentQuitException from lib.core.exception import sqlmapUserQuitException from lib.core.session import setInjection +from lib.core.session import setMatchRatio from lib.core.target import initTargetEnv from lib.core.target import setupTargetEnv from lib.core.target import findPageForms @@ -290,6 +291,8 @@ def start(): condition = True if condition: + conf.matchRatio = kb.paramMatchRatio[(kb.injPlace, kb.injParameter)] + setMatchRatio() checkForParenthesis() action() diff --git a/lib/core/option.py b/lib/core/option.py index 808e2e805..efc2f9a9b 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1098,6 +1098,7 @@ def __setKnowledgeBaseAttributes(): kb.osSP = None kb.pageStable = None + kb.paramMatchRatio = {} kb.parenthesis = None kb.partRun = None kb.proxyAuthHeader = None diff --git a/lib/core/target.py b/lib/core/target.py index 442557e0a..ecc3bc96a 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -300,6 +300,7 @@ def initTargetEnv(): kb.nullConnection = None kb.pageStable = None kb.parenthesis = None + kb.paramMatchRatio = {} kb.proxyAuthHeader = None kb.stackedTest = None kb.timeTest = None diff --git a/lib/request/comparison.py b/lib/request/comparison.py index df7f25394..b8e8e708b 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -15,7 +15,6 @@ from lib.core.common import wasLastRequestError from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.session import setMatchRatio def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): if page is None and pageLength is None: @@ -94,9 +93,6 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): logger.debug("setting match ratio to default value 0.900") conf.matchRatio = 0.900 - if conf.matchRatio is not None: - setMatchRatio() - # If it has been requested to return the ratio and not a comparison # response if getSeqMatcher: