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

Skip to content

Commit 87a92ab

Browse files
committed
Deprecating --replicate (Issue #254)
1 parent f08eb0f commit 87a92ab

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

lib/core/common.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from lib.core.convert import utf8encode
5757
from lib.core.decorators import cachedmethod
5858
from lib.core.dicts import DBMS_DICT
59+
from lib.core.dicts import DEPRECATED_HINTS
5960
from lib.core.dicts import SQL_STATEMENTS
6061
from lib.core.enums import ADJUST_TIME_DELAY
6162
from lib.core.enums import CHARSET_TYPE
@@ -86,6 +87,7 @@
8687
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
8788
from lib.core.settings import DEFAULT_GET_POST_DELIMITER
8889
from lib.core.settings import DEFAULT_MSSQL_SCHEMA
90+
from lib.core.settings import DEPRECATED_OPTIONS
8991
from lib.core.settings import DESCRIPTION
9092
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
9193
from lib.core.settings import DUMMY_USER_INJECTION
@@ -3133,6 +3135,18 @@ def getHostHeader(url):
31333135

31343136
return retVal
31353137

3138+
def checkDeprecatedOptions(args):
3139+
"""
3140+
Checks for deprecated options
3141+
"""
3142+
3143+
for _ in args:
3144+
if _ in DEPRECATED_OPTIONS:
3145+
errMsg = "switch/option '%s' is deprecated" % _
3146+
if _ in DEPRECATED_HINTS:
3147+
errMsg += " (hint: %s)" % DEPRECATED_HINTS[_]
3148+
raise sqlmapSyntaxException, errMsg
3149+
31363150
def evaluateCode(code, variables=None):
31373151
"""
31383152
Executes given python code given in a string form

lib/core/dicts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,5 @@
201201
POST_HINT.SOAP: "application/soap+xml",
202202
POST_HINT.XML: "application/xml"
203203
}
204+
205+
DEPRECATED_HINTS = {"--replicate": "use '--dump-format=SQLITE' instead"}

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@
305305
# Maximum integer value
306306
MAX_INT = sys.maxint
307307

308+
# List of deprecated options
309+
DEPRECATED_OPTIONS = ("--replicate",)
310+
308311
# Parameters to be ignored in detection phase (upper case)
309312
IGNORE_PARAMETERS = ("__VIEWSTATE", "__VIEWSTATEENCRYPTED", "__EVENTARGUMENT", "__EVENTTARGET", "__EVENTVALIDATION", "ASPSESSIONID", "ASP.NET_SESSIONID", "JSESSIONID", "CFID", "CFTOKEN")
310313

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from optparse import OptionParser
1313
from optparse import SUPPRESS_HELP
1414

15+
from lib.core.common import checkDeprecatedOptions
1516
from lib.core.common import expandMnemonics
1617
from lib.core.common import getUnicode
1718
from lib.core.data import logger
@@ -716,6 +717,8 @@ def _(self, *args):
716717
for arg in sys.argv:
717718
args.append(getUnicode(arg, system=True))
718719

720+
checkDeprecatedOptions(args)
721+
719722
# Hide non-basic options in basic help case
720723
for i in xrange(len(sys.argv)):
721724
if sys.argv[i] == '-hh':

0 commit comments

Comments
 (0)