removing obsolete switches (--threshold, --excl-reg, --excl-str)

This commit is contained in:
Miroslav Stampar 2011-02-03 15:55:19 +00:00
parent 253a8d0679
commit b56a77e573
6 changed files with 4 additions and 58 deletions

View File

@ -286,7 +286,7 @@ def start():
if (len(kb.injections) == 0 or (len(kb.injections) == 1 and kb.injections[0].place is None)) \
and (kb.injection.place is None or kb.injection.parameter is None):
if not conf.string and not conf.regexp and not conf.eRegexp:
if not conf.string and not conf.regexp:
# NOTE: this is not needed anymore, leaving only to display
# a warning message to the user in case the page is not stable
checkStability()

View File

@ -1384,10 +1384,6 @@ def __basicOptionValidation():
errMsg = "value for --cpu-throttle (cpuThrottle) option must be in range [0,100]"
raise sqlmapSyntaxException, errMsg
if conf.thold is not None and isinstance(conf.thold, float) and (conf.thold > 1 or conf.cpuThrottle < 0):
errMsg = "value for --threshold (thold) option must be in range [0,1]"
raise sqlmapSyntaxException, errMsg
if conf.textOnly and conf.nullConnection:
errMsg = "switch --text-only is incompatible with switch --null-connection"
raise sqlmapSyntaxException, errMsg

View File

@ -67,9 +67,6 @@ optDict = {
"risk": "integer",
"string": "string",
"regexp": "string",
"eString": "string",
"eRegexp": "string",
"thold": "float",
"textOnly": "boolean"
},

View File

@ -201,17 +201,6 @@ def cmdLineParser():
help="Regexp to match in page when the "
"query is valid")
detection.add_option("--excl-str", dest="eString",
help="String to be excluded before comparing "
"page contents")
detection.add_option("--excl-reg", dest="eRegexp",
help="Matches to be excluded before "
"comparing page contents")
detection.add_option("--threshold", dest="thold", type="float",
help="Page comparison threshold value (0.0-1.0)")
detection.add_option("--text-only", dest="textOnly",
action="store_true", default=False,
help="Compare pages based only on their textual content")

View File

@ -34,26 +34,6 @@ def comparison(page, getSeqMatcher=False, pageLength=None):
seqMatcher.set_seq1(kb.pageTemplate)
if page:
# String to be excluded before calculating page hash
if conf.eString and conf.eString in page:
index = page.index(conf.eString)
length = len(conf.eString)
pageWithoutString = page[:index]
pageWithoutString += page[index+length:]
page = pageWithoutString
# Regular expression matches to be excluded before calculating page hash
if conf.eRegexp:
regExpResults = re.findall(conf.eRegexp, page, re.I | re.M)
if regExpResults:
for regExpResult in regExpResults:
index = page.index(regExpResult)
length = len(regExpResult)
pageWithoutRegExp = page[:index]
pageWithoutRegExp += page[index+length:]
page = pageWithoutRegExp
# String to match in page when the query is valid
if conf.string:
return conf.string in page
@ -77,7 +57,7 @@ def comparison(page, getSeqMatcher=False, pageLength=None):
if conf.textOnly:
(seqMatcher.a, page) = map(getFilteredPageContent, (seqMatcher.a, page))
if not conf.eRegexp and not conf.eString and kb.nullConnection and pageLength:
if kb.nullConnection and pageLength:
ratio = 1. * pageLength / len(seqMatcher.a)
if ratio > 1.:
@ -89,10 +69,7 @@ def comparison(page, getSeqMatcher=False, pageLength=None):
# 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 kb.matchRatio is None:
if conf.thold:
kb.matchRatio = conf.thold
elif kb.pageStable and ratio >= LOWER_RATIO_BOUND and ratio <= UPPER_RATIO_BOUND:
if kb.pageStable and ratio >= LOWER_RATIO_BOUND and ratio <= UPPER_RATIO_BOUND:
kb.matchRatio = ratio
logger.debug("setting match ratio for current parameter to %.3f" % kb.matchRatio)
@ -112,7 +89,7 @@ def comparison(page, getSeqMatcher=False, pageLength=None):
return None
else:
if kb.matchRatio == CONSTANT_RATIO or conf.thold:
if kb.matchRatio == CONSTANT_RATIO:
return ratio > kb.matchRatio
else:
return (ratio - kb.matchRatio) > DIFF_TOLERANCE

View File

@ -220,19 +220,6 @@ string =
# (http://www.python.org/doc/2.5.2/lib/re-syntax.html)
regexp =
# String to be excluded by the page content before comparing to the original page
eString =
# Regular expression matches to be excluded by the page content before
# comparing to the original page
# Valid: regular expression with Python syntax
# (http://www.python.org/doc/2.5.2/lib/re-syntax.html)
eRegexp =
# Page comparison threshold value.
# Valid: 0.0-1.0
thold =
# Compare pages based only on their textual content
# Valid: True or False
textOnly = False