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

Skip to content

Commit 922ea9d

Browse files
committed
Update for Issue #118
1 parent f8c9868 commit 922ea9d

6 files changed

Lines changed: 15 additions & 11 deletions

File tree

lib/controller/checks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def checkSqlInjection(place, parameter, value):
137137
continue
138138

139139
# Skip tests if title is not included by the given filter
140-
if conf.tstF:
141-
if not any(re.search(conf.tstF, str(item), re.I) for item in (test.title, test.vector,\
140+
if conf.testFilter:
141+
if not any(re.search(conf.testFilter, str(item), re.I) for item in (test.title, test.vector,\
142142
test.details.dbms if "details" in test and "dbms" in test.details else "")):
143143
debugMsg = "skipping test '%s' because " % title
144144
debugMsg += "its name/vector/dbms is not included by the given filter"
@@ -478,7 +478,7 @@ def genCmpPayload():
478478
injection.dbms = Backend.setDbms(dValue)
479479
else:
480480
Backend.forceDbms(dValue[0], True)
481-
elif dKey == "dbms_version" and injection.dbms_version is None and not conf.tstF:
481+
elif dKey == "dbms_version" and injection.dbms_version is None and not conf.testFilter:
482482
injection.dbms_version = Backend.setVersion(dValue)
483483
elif dKey == "os" and injection.os is None:
484484
injection.os = Backend.setOs(dValue)

lib/core/option.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@ class _(unicode): pass
13301330
if conf.dbms:
13311331
conf.dbms = conf.dbms.capitalize()
13321332

1333-
if conf.tstF:
1334-
if not any([char in conf.tstF for char in ('.', ')', '(', ']', '[')]):
1335-
conf.tstF = conf.tstF.replace('*', '.*')
1333+
if conf.testFilter:
1334+
if not any([char in conf.testFilter for char in ('.', ')', '(', ']', '[')]):
1335+
conf.testFilter = conf.testFilter.replace('*', '.*')
13361336

13371337
if conf.timeSec not in kb.explicitSettings:
13381338
if conf.tor:

lib/core/optiondict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"mobile": "boolean",
195195
"pageRank": "boolean",
196196
"smart": "boolean",
197-
"tstF": "string",
197+
"testFilter": "string",
198198
"wizard": "boolean",
199199
"verbose": "integer"
200200
},

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,3 +519,6 @@
519519

520520
# Generic www root directory names
521521
GENERIC_DOC_ROOT_DIRECTORY_NAMES = ("htdocs", "wwwroot", "www")
522+
523+
# Maximum length of a help part containing switch/option name(s)
524+
MAX_HELP_OPTION_LENGTH = 18

lib/parse/cmdline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from lib.core.defaults import defaults
1919
from lib.core.settings import BASIC_HELP_ITEMS
2020
from lib.core.settings import IS_WIN
21+
from lib.core.settings import MAX_HELP_OPTION_LENGTH
2122
from lib.core.settings import VERSION_STRING
2223

2324
def cmdLineParser():
@@ -629,7 +630,7 @@ def cmdLineParser():
629630
action="store_true",
630631
help="Conduct through tests only if positive heuristic(s)")
631632

632-
miscellaneous.add_option("--test-filter", dest="tstF",
633+
miscellaneous.add_option("--test-filter", dest="testFilter",
633634
help="Select tests by payloads and/or titles (e.g. ROW)")
634635

635636
miscellaneous.add_option("--wizard", dest="wizard",
@@ -677,8 +678,8 @@ def cmdLineParser():
677678
# Dirty hack to display longer options without breaking into two lines
678679
def _(self, *args):
679680
_ = parser.formatter._format_option_strings(*args)
680-
if len(_) > 18:
681-
_ = "%.16s.." % _
681+
if len(_) > MAX_HELP_OPTION_LENGTH:
682+
_ = ("%%.%ds.." % (MAX_HELP_OPTION_LENGTH - parser.formatter.indent_increment)) % _
682683
return _
683684

684685
parser.formatter._format_option_strings = parser.formatter.format_option_strings

sqlmap.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ pageRank = False
669669
smart = False
670670

671671
# Select tests by payloads and/or titles (e.g. ROW)
672-
tstF =
672+
testFilter =
673673

674674
# Simple wizard interface for beginner users.
675675
# Valid: True or False

0 commit comments

Comments
 (0)