diff --git a/lib/core/common.py b/lib/core/common.py index b72066c64..793d42ad7 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -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') diff --git a/lib/core/option.py b/lib/core/option.py index 52ffeeb46..5b51c4792 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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() diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index b9adbd67b..0445ccb09 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -202,7 +202,7 @@ optDict = { "outputDir": "string", "parseErrors": "boolean", "pivotColumn": "string", - "saveCmdline": "boolean", + "saveConfig": "string", "scope": "string", "testFilter": "string", "updateAll": "boolean", diff --git a/lib/core/settings.py b/lib/core/settings.py index d92e443d4..22b0cf3bc 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -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" diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 154c5d7e3..f6d8eb852 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -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",