Added hidden (for the moment) switch --technique

This commit is contained in:
Bernardo Damele 2010-12-09 13:47:17 +00:00
parent b80a86a669
commit 5fb04515d3
3 changed files with 22 additions and 0 deletions

View File

@ -101,6 +101,15 @@ def checkSqlInjection(place, parameter, value):
stype = test.stype stype = test.stype
clause = test.clause clause = test.clause
# Skip test if the user's wants to test only for a specific
# technique
if isinstance(conf.technique, int) and stype != conf.technique:
debugMsg = "skipping test '%s' because the user " % title
debugMsg += "specified to test only for "
debugMsg += "%s" % PAYLOAD.SQLINJECTION[conf.technique]
logger.debug(debugMsg)
continue
# Skip test if the risk is higher than the provided (or default) # Skip test if the risk is higher than the provided (or default)
# value # value
# Parse test's <risk> # Parse test's <risk>

View File

@ -552,6 +552,15 @@ def __setOS():
errMsg += "you." errMsg += "you."
raise sqlmapUnsupportedDBMSException, errMsg raise sqlmapUnsupportedDBMSException, errMsg
def __setTechnique():
if not isinstance(conf.technique, int):
return
if conf.technique < 0 or conf.technique > 5:
errMsg = "the value of --technique must be an integer "
errMsg += "between 0 and 5"
raise sqlmapSyntaxException, errMsg
def __setDBMS(): def __setDBMS():
""" """
Force the back-end DBMS option. Force the back-end DBMS option.
@ -1383,6 +1392,7 @@ def init(inputOptions=advancedDict()):
__urllib2Opener() __urllib2Opener()
__findPageForms() __findPageForms()
__setDBMS() __setDBMS()
__setTechnique()
__setThreads() __setThreads()
__setOS() __setOS()

View File

@ -529,6 +529,9 @@ def cmdLineParser():
parser.add_option("--live-test", dest="liveTest", action="store_true", parser.add_option("--live-test", dest="liveTest", action="store_true",
default=False, help=SUPPRESS_HELP) default=False, help=SUPPRESS_HELP)
parser.add_option("--technique", dest="technique", type="int",
default=False, help=SUPPRESS_HELP)
parser.add_option_group(target) parser.add_option_group(target)
parser.add_option_group(request) parser.add_option_group(request)
parser.add_option_group(optimization) parser.add_option_group(optimization)