mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Switch --save becomes an option (taking file path where to save config file)
This commit is contained in:
parent
f83de446f7
commit
b010fda695
|
@ -1112,7 +1112,6 @@ def setPaths():
|
||||||
paths.SQL_SHELL_HISTORY = os.path.join(_, "sql.hst")
|
paths.SQL_SHELL_HISTORY = os.path.join(_, "sql.hst")
|
||||||
paths.SQLMAP_SHELL_HISTORY = os.path.join(_, "sqlmap.hst")
|
paths.SQLMAP_SHELL_HISTORY = os.path.join(_, "sqlmap.hst")
|
||||||
paths.GITHUB_HISTORY = os.path.join(_, "github.hst")
|
paths.GITHUB_HISTORY = os.path.join(_, "github.hst")
|
||||||
paths.SQLMAP_CONFIG = os.path.join(paths.SQLMAP_ROOT_PATH, "sqlmap-%s.conf" % randomStr())
|
|
||||||
paths.COMMON_COLUMNS = os.path.join(paths.SQLMAP_TXT_PATH, "common-columns.txt")
|
paths.COMMON_COLUMNS = os.path.join(paths.SQLMAP_TXT_PATH, "common-columns.txt")
|
||||||
paths.COMMON_TABLES = os.path.join(paths.SQLMAP_TXT_PATH, "common-tables.txt")
|
paths.COMMON_TABLES = os.path.join(paths.SQLMAP_TXT_PATH, "common-tables.txt")
|
||||||
paths.COMMON_OUTPUTS = os.path.join(paths.SQLMAP_TXT_PATH, 'common-outputs.txt')
|
paths.COMMON_OUTPUTS = os.path.join(paths.SQLMAP_TXT_PATH, 'common-outputs.txt')
|
||||||
|
|
|
@ -1964,16 +1964,16 @@ def _useWizardInterface():
|
||||||
|
|
||||||
dataToStdout("\nsqlmap is running, please wait..\n\n")
|
dataToStdout("\nsqlmap is running, please wait..\n\n")
|
||||||
|
|
||||||
def _saveCmdline():
|
def _saveConfig():
|
||||||
"""
|
"""
|
||||||
Saves the command line options on a sqlmap configuration INI file
|
Saves the command line options to a sqlmap configuration INI file
|
||||||
Format.
|
Format.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not conf.saveCmdline:
|
if not conf.saveConfig:
|
||||||
return
|
return
|
||||||
|
|
||||||
debugMsg = "saving command line options on a sqlmap configuration INI file"
|
debugMsg = "saving command line options to a sqlmap configuration INI file"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
config = UnicodeRawConfigParser()
|
config = UnicodeRawConfigParser()
|
||||||
|
@ -1997,7 +1997,7 @@ def _saveCmdline():
|
||||||
datatype = datatype[0]
|
datatype = datatype[0]
|
||||||
|
|
||||||
if option in IGNORE_SAVE_OPTIONS:
|
if option in IGNORE_SAVE_OPTIONS:
|
||||||
value = None
|
continue
|
||||||
|
|
||||||
if value is None:
|
if value is None:
|
||||||
if datatype == OPTION_TYPE.BOOLEAN:
|
if datatype == OPTION_TYPE.BOOLEAN:
|
||||||
|
@ -2015,16 +2015,16 @@ def _saveCmdline():
|
||||||
|
|
||||||
config.set(family, option, value)
|
config.set(family, option, value)
|
||||||
|
|
||||||
confFP = openFile(paths.SQLMAP_CONFIG, "wb")
|
confFP = openFile(conf.saveConfig, "wb")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config.write(confFP)
|
config.write(confFP)
|
||||||
except IOError, ex:
|
except IOError, ex:
|
||||||
errMsg = "something went wrong while trying "
|
errMsg = "something went wrong while trying "
|
||||||
errMsg += "to write to the configuration file '%s' ('%s')" % (paths.SQLMAP_CONFIG, ex)
|
errMsg += "to write to the configuration file '%s' ('%s')" % (conf.saveConfig, ex)
|
||||||
raise SqlmapSystemException(errMsg)
|
raise SqlmapSystemException(errMsg)
|
||||||
|
|
||||||
infoMsg = "saved command line options to the configuration file '%s'" % paths.SQLMAP_CONFIG
|
infoMsg = "saved command line options to the configuration file '%s'" % conf.saveConfig
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
def setVerbosity():
|
def setVerbosity():
|
||||||
|
@ -2479,7 +2479,7 @@ def init():
|
||||||
|
|
||||||
_useWizardInterface()
|
_useWizardInterface()
|
||||||
setVerbosity()
|
setVerbosity()
|
||||||
_saveCmdline()
|
_saveConfig()
|
||||||
_setRequestFromFile()
|
_setRequestFromFile()
|
||||||
_cleanupOptions()
|
_cleanupOptions()
|
||||||
_dirtyPatches()
|
_dirtyPatches()
|
||||||
|
|
|
@ -202,7 +202,7 @@ optDict = {
|
||||||
"outputDir": "string",
|
"outputDir": "string",
|
||||||
"parseErrors": "boolean",
|
"parseErrors": "boolean",
|
||||||
"pivotColumn": "string",
|
"pivotColumn": "string",
|
||||||
"saveCmdline": "boolean",
|
"saveConfig": "string",
|
||||||
"scope": "string",
|
"scope": "string",
|
||||||
"testFilter": "string",
|
"testFilter": "string",
|
||||||
"updateAll": "boolean",
|
"updateAll": "boolean",
|
||||||
|
|
|
@ -387,7 +387,7 @@ CODECS_LIST_PAGE = "http://docs.python.org/library/codecs.html#standard-encoding
|
||||||
SQL_SCALAR_REGEX = r"\A(SELECT(?!\s+DISTINCT\(?))?\s*\w*\("
|
SQL_SCALAR_REGEX = r"\A(SELECT(?!\s+DISTINCT\(?))?\s*\w*\("
|
||||||
|
|
||||||
# Option/switch values to ignore during configuration save
|
# Option/switch values to ignore during configuration save
|
||||||
IGNORE_SAVE_OPTIONS = ("saveCmdline",)
|
IGNORE_SAVE_OPTIONS = ("saveConfig",)
|
||||||
|
|
||||||
# IP address of the localhost
|
# IP address of the localhost
|
||||||
LOCALHOST = "127.0.0.1"
|
LOCALHOST = "127.0.0.1"
|
||||||
|
|
|
@ -662,8 +662,7 @@ def cmdLineParser():
|
||||||
general.add_option("--pivot-column", dest="pivotColumn",
|
general.add_option("--pivot-column", dest="pivotColumn",
|
||||||
help="Pivot column name")
|
help="Pivot column name")
|
||||||
|
|
||||||
general.add_option("--save", dest="saveCmdline",
|
general.add_option("--save", dest="saveConfig",
|
||||||
action="store_true",
|
|
||||||
help="Save options to a configuration INI file")
|
help="Save options to a configuration INI file")
|
||||||
|
|
||||||
general.add_option("--scope", dest="scope",
|
general.add_option("--scope", dest="scope",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user