mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
adding a new (for now) hidden switch --test-filter for filtering tests by their name
This commit is contained in:
parent
fd9acfd7d2
commit
88f1110c44
|
@ -146,6 +146,13 @@ def checkSqlInjection(place, parameter, value):
|
|||
logger.debug(debugMsg)
|
||||
continue
|
||||
|
||||
# Skip tests if title is not included by the given filter
|
||||
if conf.testFilter and not re.search(conf.testFilter, test.title, re.I):
|
||||
debugMsg = "skipping test '%s' because " % title
|
||||
debugMsg += "it's name is not included by the given filter"
|
||||
logger.debug(debugMsg)
|
||||
continue
|
||||
|
||||
# Skip DBMS-specific test if it does not match either the
|
||||
# previously identified or the user's provided DBMS (either
|
||||
# from program switch or from parsed error message(s))
|
||||
|
@ -160,14 +167,12 @@ def checkSqlInjection(place, parameter, value):
|
|||
debugMsg += "the back-end DBMS identified is "
|
||||
debugMsg += "%s" % injection.dbms
|
||||
logger.debug(debugMsg)
|
||||
|
||||
continue
|
||||
|
||||
if conf.dbms is not None and not intersect(conf.dbms.lower(), [value.lower() for value in arrayizeValue(dbms)]):
|
||||
debugMsg = "skipping test '%s' because " % title
|
||||
debugMsg += "the provided DBMS is %s" % conf.dbms
|
||||
logger.debug(debugMsg)
|
||||
|
||||
continue
|
||||
|
||||
if len(Backend.getErrorParsedDBMSes()) > 0 and not intersect(dbms, Backend.getErrorParsedDBMSes()) and kb.skipOthersDbms is None:
|
||||
|
@ -186,7 +191,6 @@ def checkSqlInjection(place, parameter, value):
|
|||
debugMsg += "that the back-end DBMS could be "
|
||||
debugMsg += "%s" % Format.getErrorParsedDBMSes()
|
||||
logger.debug(debugMsg)
|
||||
|
||||
continue
|
||||
|
||||
# Skip test if it does not match the same SQL injection clause
|
||||
|
|
|
@ -1329,6 +1329,10 @@ def __cleanupOptions():
|
|||
if conf.dbms:
|
||||
conf.dbms = conf.dbms.capitalize()
|
||||
|
||||
if conf.testFilter:
|
||||
if not any([char in conf.testFilter for char in ('.', ')', '(', ']', '[')]):
|
||||
conf.testFilter = conf.testFilter.replace('*', '.*')
|
||||
|
||||
if conf.timeSec not in kb.explicitSettings:
|
||||
if conf.tor:
|
||||
conf.timeSec = 2 * conf.timeSec
|
||||
|
|
|
@ -591,6 +591,9 @@ def cmdLineParser():
|
|||
parser.add_option("--no-cast", dest="noCast", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--test-filter", dest="testFilter",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option_group(target)
|
||||
parser.add_option_group(request)
|
||||
parser.add_option_group(optimization)
|
||||
|
|
Loading…
Reference in New Issue
Block a user