Adding deprecated options (along with obsolete)

This commit is contained in:
Miroslav Stampar 2019-06-06 13:08:56 +02:00
parent 1c2dec031c
commit 87525d8bcb
4 changed files with 18 additions and 6 deletions

View File

@ -70,6 +70,7 @@ from lib.core.decorators import cachedmethod
from lib.core.defaults import defaults from lib.core.defaults import defaults
from lib.core.dicts import DBMS_DICT from lib.core.dicts import DBMS_DICT
from lib.core.dicts import DEFAULT_DOC_ROOTS from lib.core.dicts import DEFAULT_DOC_ROOTS
from lib.core.dicts import DEPRECATED_OPTIONS
from lib.core.dicts import OBSOLETE_OPTIONS from lib.core.dicts import OBSOLETE_OPTIONS
from lib.core.dicts import SQL_STATEMENTS from lib.core.dicts import SQL_STATEMENTS
from lib.core.enums import ADJUST_TIME_DELAY from lib.core.enums import ADJUST_TIME_DELAY
@ -4466,9 +4467,9 @@ def getHostHeader(url):
return retVal return retVal
def checkObsoleteOptions(args): def checkOldOptions(args):
""" """
Checks for obsolete options Checks for obsolete/deprecated options
""" """
for _ in args: for _ in args:
@ -4478,6 +4479,11 @@ def checkObsoleteOptions(args):
if OBSOLETE_OPTIONS[_]: if OBSOLETE_OPTIONS[_]:
errMsg += " (hint: %s)" % OBSOLETE_OPTIONS[_] errMsg += " (hint: %s)" % OBSOLETE_OPTIONS[_]
raise SqlmapSyntaxException(errMsg) raise SqlmapSyntaxException(errMsg)
elif _ in DEPRECATED_OPTIONS:
warnMsg = "switch/option '%s' is deprecated" % _
if DEPRECATED_OPTIONS[_]:
warnMsg += " (hint: %s)" % DEPRECATED_OPTIONS[_]
logger.warn(warnMsg)
def checkSystemEncoding(): def checkSystemEncoding():
""" """

View File

@ -290,10 +290,13 @@ OBSOLETE_OPTIONS = {
"--purge-output": "use '--purge' instead", "--purge-output": "use '--purge' instead",
"--check-payload": None, "--check-payload": None,
"--check-waf": None, "--check-waf": None,
"--identify-waf": "functionality being done automatically",
"--pickled-options": "use '--api -c ...' instead", "--pickled-options": "use '--api -c ...' instead",
} }
DEPRECATED_OPTIONS = {
"--identify-waf": "functionality being done automatically",
}
DUMP_DATA_PREPROCESS = { DUMP_DATA_PREPROCESS = {
DBMS.ORACLE: {"XMLTYPE": "(%s).getStringVal()"}, # Reference: https://www.tibcommunity.com/docs/DOC-3643 DBMS.ORACLE: {"XMLTYPE": "(%s).getStringVal()"}, # Reference: https://www.tibcommunity.com/docs/DOC-3643
DBMS.MSSQL: {"IMAGE": "CONVERT(VARBINARY(MAX),%s)"}, DBMS.MSSQL: {"IMAGE": "CONVERT(VARBINARY(MAX),%s)"},

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.6.24" VERSION = "1.3.6.25"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -17,7 +17,7 @@ from optparse import OptionGroup
from optparse import OptionParser from optparse import OptionParser
from optparse import SUPPRESS_HELP from optparse import SUPPRESS_HELP
from lib.core.common import checkObsoleteOptions from lib.core.common import checkOldOptions
from lib.core.common import checkSystemEncoding from lib.core.common import checkSystemEncoding
from lib.core.common import dataToStdout from lib.core.common import dataToStdout
from lib.core.common import expandMnemonics from lib.core.common import expandMnemonics
@ -28,6 +28,7 @@ from lib.core.data import cmdLineOptions
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import logger from lib.core.data import logger
from lib.core.defaults import defaults from lib.core.defaults import defaults
from lib.core.dicts import DEPRECATED_OPTIONS
from lib.core.enums import AUTOCOMPLETE_TYPE from lib.core.enums import AUTOCOMPLETE_TYPE
from lib.core.exception import SqlmapShellQuitException from lib.core.exception import SqlmapShellQuitException
from lib.core.exception import SqlmapSyntaxException from lib.core.exception import SqlmapSyntaxException
@ -789,7 +790,7 @@ def cmdLineParser(argv=None):
_.append(getUnicode(arg, encoding=sys.stdin.encoding)) _.append(getUnicode(arg, encoding=sys.stdin.encoding))
argv = _ argv = _
checkObsoleteOptions(argv) checkOldOptions(argv)
prompt = "--sqlmap-shell" in argv prompt = "--sqlmap-shell" in argv
@ -854,6 +855,8 @@ def cmdLineParser(argv=None):
elif re.search(r"\A-\w=.+", argv[i]): elif re.search(r"\A-\w=.+", argv[i]):
dataToStdout("[!] potentially miswritten (illegal '=') short option detected ('%s')\n" % argv[i]) dataToStdout("[!] potentially miswritten (illegal '=') short option detected ('%s')\n" % argv[i])
raise SystemExit raise SystemExit
elif argv[i] in DEPRECATED_OPTIONS:
argv[i] = ""
elif argv[i].startswith("--tamper"): elif argv[i].startswith("--tamper"):
if tamperIndex is None: if tamperIndex is None:
tamperIndex = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None) tamperIndex = i if '=' in argv[i] else (i + 1 if i + 1 < len(argv) and not argv[i + 1].startswith('-') else None)