fix for a Bug #200

This commit is contained in:
Miroslav Stampar 2010-09-14 10:35:01 +00:00
parent 77a53228c5
commit 798ab4989b
5 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -72,6 +72,7 @@ optDict = {
"regexp": "string",
"eString": "string",
"eRegexp": "string",
"thold": "float",
"useBetween": "boolean",
},

View File

@ -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",

View File

@ -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

View File

@ -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