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

Skip to content

Commit b010fda

Browse files
committed
Switch --save becomes an option (taking file path where to save config file)
1 parent f83de44 commit b010fda

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

lib/core/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,6 @@ def setPaths():
11121112
paths.SQL_SHELL_HISTORY = os.path.join(_, "sql.hst")
11131113
paths.SQLMAP_SHELL_HISTORY = os.path.join(_, "sqlmap.hst")
11141114
paths.GITHUB_HISTORY = os.path.join(_, "github.hst")
1115-
paths.SQLMAP_CONFIG = os.path.join(paths.SQLMAP_ROOT_PATH, "sqlmap-%s.conf" % randomStr())
11161115
paths.COMMON_COLUMNS = os.path.join(paths.SQLMAP_TXT_PATH, "common-columns.txt")
11171116
paths.COMMON_TABLES = os.path.join(paths.SQLMAP_TXT_PATH, "common-tables.txt")
11181117
paths.COMMON_OUTPUTS = os.path.join(paths.SQLMAP_TXT_PATH, 'common-outputs.txt')

lib/core/option.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,16 +1964,16 @@ def _useWizardInterface():
19641964

19651965
dataToStdout("\nsqlmap is running, please wait..\n\n")
19661966

1967-
def _saveCmdline():
1967+
def _saveConfig():
19681968
"""
1969-
Saves the command line options on a sqlmap configuration INI file
1969+
Saves the command line options to a sqlmap configuration INI file
19701970
Format.
19711971
"""
19721972

1973-
if not conf.saveCmdline:
1973+
if not conf.saveConfig:
19741974
return
19751975

1976-
debugMsg = "saving command line options on a sqlmap configuration INI file"
1976+
debugMsg = "saving command line options to a sqlmap configuration INI file"
19771977
logger.debug(debugMsg)
19781978

19791979
config = UnicodeRawConfigParser()
@@ -1997,7 +1997,7 @@ def _saveCmdline():
19971997
datatype = datatype[0]
19981998

19991999
if option in IGNORE_SAVE_OPTIONS:
2000-
value = None
2000+
continue
20012001

20022002
if value is None:
20032003
if datatype == OPTION_TYPE.BOOLEAN:
@@ -2015,16 +2015,16 @@ def _saveCmdline():
20152015

20162016
config.set(family, option, value)
20172017

2018-
confFP = openFile(paths.SQLMAP_CONFIG, "wb")
2018+
confFP = openFile(conf.saveConfig, "wb")
20192019

20202020
try:
20212021
config.write(confFP)
20222022
except IOError, ex:
20232023
errMsg = "something went wrong while trying "
2024-
errMsg += "to write to the configuration file '%s' ('%s')" % (paths.SQLMAP_CONFIG, ex)
2024+
errMsg += "to write to the configuration file '%s' ('%s')" % (conf.saveConfig, ex)
20252025
raise SqlmapSystemException(errMsg)
20262026

2027-
infoMsg = "saved command line options to the configuration file '%s'" % paths.SQLMAP_CONFIG
2027+
infoMsg = "saved command line options to the configuration file '%s'" % conf.saveConfig
20282028
logger.info(infoMsg)
20292029

20302030
def setVerbosity():
@@ -2479,7 +2479,7 @@ def init():
24792479

24802480
_useWizardInterface()
24812481
setVerbosity()
2482-
_saveCmdline()
2482+
_saveConfig()
24832483
_setRequestFromFile()
24842484
_cleanupOptions()
24852485
_dirtyPatches()

lib/core/optiondict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
"outputDir": "string",
203203
"parseErrors": "boolean",
204204
"pivotColumn": "string",
205-
"saveCmdline": "boolean",
205+
"saveConfig": "string",
206206
"scope": "string",
207207
"testFilter": "string",
208208
"updateAll": "boolean",

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
SQL_SCALAR_REGEX = r"\A(SELECT(?!\s+DISTINCT\(?))?\s*\w*\("
388388

389389
# Option/switch values to ignore during configuration save
390-
IGNORE_SAVE_OPTIONS = ("saveCmdline",)
390+
IGNORE_SAVE_OPTIONS = ("saveConfig",)
391391

392392
# IP address of the localhost
393393
LOCALHOST = "127.0.0.1"

lib/parse/cmdline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,7 @@ def cmdLineParser():
662662
general.add_option("--pivot-column", dest="pivotColumn",
663663
help="Pivot column name")
664664

665-
general.add_option("--save", dest="saveCmdline",
666-
action="store_true",
665+
general.add_option("--save", dest="saveConfig",
667666
help="Save options to a configuration INI file")
668667

669668
general.add_option("--scope", dest="scope",

0 commit comments

Comments
 (0)