Deprecating --replicate (Issue #254)

This commit is contained in:
Miroslav Stampar 2012-11-28 11:10:57 +01:00
parent f08eb0fd9f
commit 87a92ab330
4 changed files with 22 additions and 0 deletions

View File

@ -56,6 +56,7 @@ from lib.core.convert import unicodeencode
from lib.core.convert import utf8encode
from lib.core.decorators import cachedmethod
from lib.core.dicts import DBMS_DICT
from lib.core.dicts import DEPRECATED_HINTS
from lib.core.dicts import SQL_STATEMENTS
from lib.core.enums import ADJUST_TIME_DELAY
from lib.core.enums import CHARSET_TYPE
@ -86,6 +87,7 @@ from lib.core.settings import DBMS_DIRECTORY_DICT
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
from lib.core.settings import DEFAULT_MSSQL_SCHEMA
from lib.core.settings import DEPRECATED_OPTIONS
from lib.core.settings import DESCRIPTION
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
from lib.core.settings import DUMMY_USER_INJECTION
@ -3133,6 +3135,18 @@ def getHostHeader(url):
return retVal
def checkDeprecatedOptions(args):
"""
Checks for deprecated options
"""
for _ in args:
if _ in DEPRECATED_OPTIONS:
errMsg = "switch/option '%s' is deprecated" % _
if _ in DEPRECATED_HINTS:
errMsg += " (hint: %s)" % DEPRECATED_HINTS[_]
raise sqlmapSyntaxException, errMsg
def evaluateCode(code, variables=None):
"""
Executes given python code given in a string form

View File

@ -201,3 +201,5 @@ POST_HINT_CONTENT_TYPES = {
POST_HINT.SOAP: "application/soap+xml",
POST_HINT.XML: "application/xml"
}
DEPRECATED_HINTS = {"--replicate": "use '--dump-format=SQLITE' instead"}

View File

@ -305,6 +305,9 @@ HASH_MOD_ITEM_DISPLAY = 11
# Maximum integer value
MAX_INT = sys.maxint
# List of deprecated options
DEPRECATED_OPTIONS = ("--replicate",)
# Parameters to be ignored in detection phase (upper case)
IGNORE_PARAMETERS = ("__VIEWSTATE", "__VIEWSTATEENCRYPTED", "__EVENTARGUMENT", "__EVENTTARGET", "__EVENTVALIDATION", "ASPSESSIONID", "ASP.NET_SESSIONID", "JSESSIONID", "CFID", "CFTOKEN")

View File

@ -12,6 +12,7 @@ from optparse import OptionGroup
from optparse import OptionParser
from optparse import SUPPRESS_HELP
from lib.core.common import checkDeprecatedOptions
from lib.core.common import expandMnemonics
from lib.core.common import getUnicode
from lib.core.data import logger
@ -716,6 +717,8 @@ def cmdLineParser():
for arg in sys.argv:
args.append(getUnicode(arg, system=True))
checkDeprecatedOptions(args)
# Hide non-basic options in basic help case
for i in xrange(len(sys.argv)):
if sys.argv[i] == '-hh':