diff --git a/lib/controller/checks.py b/lib/controller/checks.py index eac95629e..e03b8909d 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -207,6 +207,16 @@ def checkSqlInjection(place, parameter, value): logger.debug(debugMsg) continue + # Skip tests if title, vector or DBMS is included by the + # given skip filter + if conf.testSkip and any(conf.testSkip in str(item) or \ + re.search(conf.testSkip, str(item), re.I) for item in \ + (test.title, test.vector, payloadDbms)): + debugMsg = "skipping test '%s' because its " % title + debugMsg += "name/vector/DBMS is included by the given skip filter" + logger.debug(debugMsg) + continue + if payloadDbms is not None: # Skip DBMS-specific test if it does not match the user's # provided DBMS diff --git a/lib/core/option.py b/lib/core/option.py index d73b512bc..f51e5210c 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1634,6 +1634,10 @@ def _cleanupOptions(): conf.testFilter = conf.testFilter.strip('*+') conf.testFilter = re.sub(r"([^.])([*+])", "\g<1>.\g<2>", conf.testFilter) + if conf.testSkip: + conf.testSkip = conf.testSkip.strip('*+') + conf.testSkip = re.sub(r"([^.])([*+])", "\g<1>.\g<2>", conf.testSkip) + if "timeSec" not in kb.explicitSettings: if conf.tor: conf.timeSec = 2 * conf.timeSec diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 257f86eb0..9eb0d121a 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -205,6 +205,7 @@ optDict = { "saveConfig": "string", "scope": "string", "testFilter": "string", + "testSkip": "string", "updateAll": "boolean", }, diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index b801bab95..03bb1ac80 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -674,6 +674,9 @@ def cmdLineParser(argv=None): general.add_option("--test-filter", dest="testFilter", help="Select tests by payloads and/or titles (e.g. ROW)") + general.add_option("--test-skip", dest="testSkip", + help="Skip tests by payloads and/or titles (e.g. BENCHMARK)") + general.add_option("--update", dest="updateAll", action="store_true", help="Update sqlmap") diff --git a/sqlmap.conf b/sqlmap.conf index 2bcd15f1d..fb0e00185 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -708,6 +708,9 @@ scope = # Select tests by payloads and/or titles (e.g. ROW) testFilter = +# Skip tests by payloads and/or titles (e.g. BENCHMARK) +testSkip = + # Update sqlmap. # Valid: True or False updateAll = False