mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +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.SQLMAP_SHELL_HISTORY = os.path.join(_, "sqlmap.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_TABLES = os.path.join(paths.SQLMAP_TXT_PATH, "common-tables.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")
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
if not conf.saveCmdline:
|
||||
if not conf.saveConfig:
|
||||
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)
|
||||
|
||||
config = UnicodeRawConfigParser()
|
||||
|
@ -1997,7 +1997,7 @@ def _saveCmdline():
|
|||
datatype = datatype[0]
|
||||
|
||||
if option in IGNORE_SAVE_OPTIONS:
|
||||
value = None
|
||||
continue
|
||||
|
||||
if value is None:
|
||||
if datatype == OPTION_TYPE.BOOLEAN:
|
||||
|
@ -2015,16 +2015,16 @@ def _saveCmdline():
|
|||
|
||||
config.set(family, option, value)
|
||||
|
||||
confFP = openFile(paths.SQLMAP_CONFIG, "wb")
|
||||
confFP = openFile(conf.saveConfig, "wb")
|
||||
|
||||
try:
|
||||
config.write(confFP)
|
||||
except IOError, ex:
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
def setVerbosity():
|
||||
|
@ -2479,7 +2479,7 @@ def init():
|
|||
|
||||
_useWizardInterface()
|
||||
setVerbosity()
|
||||
_saveCmdline()
|
||||
_saveConfig()
|
||||
_setRequestFromFile()
|
||||
_cleanupOptions()
|
||||
_dirtyPatches()
|
||||
|
|
|
@ -202,7 +202,7 @@ optDict = {
|
|||
"outputDir": "string",
|
||||
"parseErrors": "boolean",
|
||||
"pivotColumn": "string",
|
||||
"saveCmdline": "boolean",
|
||||
"saveConfig": "string",
|
||||
"scope": "string",
|
||||
"testFilter": "string",
|
||||
"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*\("
|
||||
|
||||
# Option/switch values to ignore during configuration save
|
||||
IGNORE_SAVE_OPTIONS = ("saveCmdline",)
|
||||
IGNORE_SAVE_OPTIONS = ("saveConfig",)
|
||||
|
||||
# IP address of the localhost
|
||||
LOCALHOST = "127.0.0.1"
|
||||
|
|
|
@ -662,8 +662,7 @@ def cmdLineParser():
|
|||
general.add_option("--pivot-column", dest="pivotColumn",
|
||||
help="Pivot column name")
|
||||
|
||||
general.add_option("--save", dest="saveCmdline",
|
||||
action="store_true",
|
||||
general.add_option("--save", dest="saveConfig",
|
||||
help="Save options to a configuration INI file")
|
||||
|
||||
general.add_option("--scope", dest="scope",
|
||||
|
|
Loading…
Reference in New Issue
Block a user