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

Skip to content

Commit 87525d8

Browse files
committed
Adding deprecated options (along with obsolete)
1 parent 1c2dec0 commit 87525d8

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

lib/core/common.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from lib.core.defaults import defaults
7171
from lib.core.dicts import DBMS_DICT
7272
from lib.core.dicts import DEFAULT_DOC_ROOTS
73+
from lib.core.dicts import DEPRECATED_OPTIONS
7374
from lib.core.dicts import OBSOLETE_OPTIONS
7475
from lib.core.dicts import SQL_STATEMENTS
7576
from lib.core.enums import ADJUST_TIME_DELAY
@@ -4466,9 +4467,9 @@ def getHostHeader(url):
44664467

44674468
return retVal
44684469

4469-
def checkObsoleteOptions(args):
4470+
def checkOldOptions(args):
44704471
"""
4471-
Checks for obsolete options
4472+
Checks for obsolete/deprecated options
44724473
"""
44734474

44744475
for _ in args:
@@ -4478,6 +4479,11 @@ def checkObsoleteOptions(args):
44784479
if OBSOLETE_OPTIONS[_]:
44794480
errMsg += " (hint: %s)" % OBSOLETE_OPTIONS[_]
44804481
raise SqlmapSyntaxException(errMsg)
4482+
elif _ in DEPRECATED_OPTIONS:
4483+
warnMsg = "switch/option '%s' is deprecated" % _
4484+
if DEPRECATED_OPTIONS[_]:
4485+
warnMsg += " (hint: %s)" % DEPRECATED_OPTIONS[_]
4486+
logger.warn(warnMsg)
44814487

44824488
def checkSystemEncoding():
44834489
"""

lib/core/dicts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,13 @@
290290
"--purge-output": "use '--purge' instead",
291291
"--check-payload": None,
292292
"--check-waf": None,
293-
"--identify-waf": "functionality being done automatically",
294293
"--pickled-options": "use '--api -c ...' instead",
295294
}
296295

296+
DEPRECATED_OPTIONS = {
297+
"--identify-waf": "functionality being done automatically",
298+
}
299+
297300
DUMP_DATA_PREPROCESS = {
298301
DBMS.ORACLE: {"XMLTYPE": "(%s).getStringVal()"}, # Reference: https://www.tibcommunity.com/docs/DOC-3643
299302
DBMS.MSSQL: {"IMAGE": "CONVERT(VARBINARY(MAX),%s)"},

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.6.24"
21+
VERSION = "1.3.6.25"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/parse/cmdline.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from optparse import OptionParser
1818
from optparse import SUPPRESS_HELP
1919

20-
from lib.core.common import checkObsoleteOptions
20+
from lib.core.common import checkOldOptions
2121
from lib.core.common import checkSystemEncoding
2222
from lib.core.common import dataToStdout
2323
from lib.core.common import expandMnemonics
@@ -28,6 +28,7 @@
2828
from lib.core.data import conf
2929
from lib.core.data import logger
3030
from lib.core.defaults import defaults
31+
from lib.core.dicts import DEPRECATED_OPTIONS
3132
from lib.core.enums import AUTOCOMPLETE_TYPE
3233
from lib.core.exception import SqlmapShellQuitException
3334
from lib.core.exception import SqlmapSyntaxException
@@ -789,7 +790,7 @@ def _(self, *args):
789790
_.append(getUnicode(arg, encoding=sys.stdin.encoding))
790791

791792
argv = _
792-
checkObsoleteOptions(argv)
793+
checkOldOptions(argv)
793794

794795
prompt = "--sqlmap-shell" in argv
795796

@@ -854,6 +855,8 @@ def _(self, *args):
854855
elif re.search(r"\A-\w=.+", argv[i]):
855856
dataToStdout("[!] potentially miswritten (illegal '=') short option detected ('%s')\n" % argv[i])
856857
raise SystemExit
858+
elif argv[i] in DEPRECATED_OPTIONS:
859+
argv[i] = ""
857860
elif argv[i].startswith("--tamper"):
858861
if tamperIndex is None:
859862
tamperIndex = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None)

0 commit comments

Comments
 (0)