From 798ab4989b0514646c7a82225725f77400334f24 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 14 Sep 2010 10:35:01 +0000 Subject: [PATCH] fix for a Bug #200 --- lib/core/option.py | 1 + lib/core/optiondict.py | 1 + lib/parse/cmdline.py | 4 ++-- lib/request/comparison.py | 9 ++++++--- sqlmap.conf | 4 ++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 14141967f..053b1faa9 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -954,6 +954,7 @@ def __setConfAttributes(): conf.httpHeaders = [] conf.hostname = None conf.loggedToOut = None + conf.matchRatio = None conf.md5hash = None conf.multipleTargets = False conf.outputPath = None diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 373d03412..2051e77f4 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -72,6 +72,7 @@ optDict = { "regexp": "string", "eString": "string", "eRegexp": "string", + "thold": "float", "useBetween": "boolean", }, diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index bc16420b6..784d15d83 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -191,8 +191,8 @@ def cmdLineParser(): help="Matches to be excluded before " "comparing page contents") - injection.add_option("--ratio", dest="matchRatio", type="float", - help="Page comparison treshold value") + injection.add_option("--threshold", dest="thold", type="float", + help="Page comparison threshold value (0.0-1.0)") injection.add_option("--use-between", dest="useBetween", action="store_true", diff --git a/lib/request/comparison.py b/lib/request/comparison.py index c35c5f67f..da0152d6b 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -88,7 +88,10 @@ def comparison(page, headers=None, getSeqMatcher=False): # If the url is stable and we did not set yet the match ratio and the # current injected value changes the url page content if conf.matchRatio is None: - if conf.md5hash is not None and ratio > 0.6 and ratio < 1: + if conf.thold: + conf.matchRatio = conf.thold + + elif conf.md5hash is not None and ratio > 0.6 and ratio < 1: logger.debug("setting match ratio to %.3f" % ratio) conf.matchRatio = ratio @@ -96,8 +99,8 @@ def comparison(page, headers=None, getSeqMatcher=False): logger.debug("setting match ratio to default value 0.900") conf.matchRatio = 0.900 - if conf.matchRatio is not None: - setMatchRatio() + if conf.matchRatio is not None: + setMatchRatio() # If it has been requested to return the ratio and not a comparison # response diff --git a/sqlmap.conf b/sqlmap.conf index 24d8f8e77..0022e5bd9 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -187,6 +187,10 @@ eString = # (http://www.python.org/doc/2.5.2/lib/re-syntax.html) eRegexp = +# Page comparison threshold value (aka matchRatio) +# Valid: 0.0-1.0 +thold = + # Use operator BETWEEN instead of default '>' # Valid: True or False useBetween = False