Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 057ec8a

Browse files
committed
added --ratio option for direct manipulation of conf.matchRatio parameter
1 parent 02523db commit 057ec8a

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

lib/core/option.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ def __setConfAttributes():
943943
conf.httpHeaders = []
944944
conf.hostname = None
945945
conf.loggedToOut = None
946-
conf.matchRatio = None
947946
conf.md5hash = None
948947
conf.multipleTargets = False
949948
conf.outputPath = None
@@ -1136,6 +1135,11 @@ def __basicOptionValidation():
11361135
errMsg = "value for --cpu-throttle (cpuThrottle) option must be in range [0,100]"
11371136
raise sqlmapSyntaxException, errMsg
11381137

1138+
if conf.matchRatio is not None and isinstance(conf.matchRatio, float) and (conf.matchRatio > 1 or\
1139+
conf.cpuThrottle < 0):
1140+
errMsg = "value for --ratio (matchRatio) option must be in range [0,1]"
1141+
raise sqlmapSyntaxException, errMsg
1142+
11391143
def init(inputOptions=advancedDict()):
11401144
"""
11411145
Set attributes into both configuration and knowledge base singletons

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ def cmdLineParser():
187187
help="Matches to be excluded before "
188188
"comparing page contents")
189189

190+
injection.add_option("--ratio", dest="matchRatio", type="float",
191+
help="Page comparison treshold value")
192+
190193
injection.add_option("--use-between", dest="useBetween",
191194
action="store_true",
192195
help="Use operator BETWEEN instead of default '>'")

lib/request/comparison.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def comparison(page, headers=None, getSeqMatcher=False):
7979
logger.debug("setting match ratio to default value 0.900")
8080
conf.matchRatio = 0.900
8181

82-
if conf.matchRatio is not None:
83-
setMatchRatio()
82+
if conf.matchRatio is not None:
83+
setMatchRatio()
8484

8585
# If it has been requested to return the ratio and not a comparison
8686
# response

0 commit comments

Comments
 (0)