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

Skip to content

Commit 7eef76f

Browse files
committed
added basic option validation for start/stop values regarding David Guimaraes mail
1 parent a1b1f96 commit 7eef76f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

lib/core/option.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,20 @@ def __mergeOptions(inputOptions):
10561056
if not conf.has_key(key) or conf[key] is None or value is not None:
10571057
conf[key] = value
10581058

1059+
def __basicOptionValidation():
1060+
if conf.limitStart is not None and not (isinstance(conf.limitStart, int) and conf.limitStart > 0):
1061+
errMsg = "value for LIMITSTART provided with --start option must be an integer value greater than zero (>0)"
1062+
raise sqlmapSyntaxException, errMsg
1063+
1064+
if conf.limitStop is not None and not (isinstance(conf.limitStop, int) and conf.limitStop > 0):
1065+
errMsg = "value for LIMITSTOP provided with --stop option must be an integer value greater than zero (>0)"
1066+
raise sqlmapSyntaxException, errMsg
1067+
1068+
if conf.limitStart is not None and isinstance(conf.limitStart, int) and conf.limitStart > 0 and\
1069+
conf.limitStop is not None and isinstance(conf.limitStop, int) and conf.limitStop > 0 and conf.limitStop <= conf.limitStart:
1070+
errMsg = "value for LIMITSTART provided with --start option must be smaller than value for LIMITSTOP provided with --stop option"
1071+
raise sqlmapSyntaxException, errMsg
1072+
10591073
def init(inputOptions=advancedDict()):
10601074
"""
10611075
Set attributes into both configuration and knowledge base singletons
@@ -1068,6 +1082,7 @@ def init(inputOptions=advancedDict()):
10681082
__setConfAttributes()
10691083
__setKnowledgeBaseAttributes()
10701084
__cleanupOptions()
1085+
__basicOptionValidation()
10711086
__setRequestFromFile()
10721087

10731088
parseTargetUrl()

0 commit comments

Comments
 (0)