mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-31 18:39:46 +03:00
Added --output-dir option to allow specifying directory for storing files.
* _sqlmap.py - move command line parsing to earlier in main function to allow setPaths to know output_dir. Change cmdLineOptions update to reflect earlier parsing * lib/core/common.py - setPaths is now passed the command line options so they can be used for setting the path. * lib/core/cmdline.py - added OptionParser option for the new option.
This commit is contained in:
parent
8eefe4b71f
commit
0b5032c503
|
@ -58,14 +58,15 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
paths.SQLMAP_ROOT_PATH = modulePath()
|
paths.SQLMAP_ROOT_PATH = modulePath()
|
||||||
setPaths()
|
options = cmdLineParser()
|
||||||
|
setPaths(options)
|
||||||
banner()
|
banner()
|
||||||
|
|
||||||
dataToStdout("[!] legal disclaimer: %s\n\n" % LEGAL_DISCLAIMER, forceOutput=True)
|
dataToStdout("[!] legal disclaimer: %s\n\n" % LEGAL_DISCLAIMER, forceOutput=True)
|
||||||
dataToStdout("[*] starting at %s\n\n" % time.strftime("%X"), forceOutput=True)
|
dataToStdout("[*] starting at %s\n\n" % time.strftime("%X"), forceOutput=True)
|
||||||
|
|
||||||
# Store original command line options for possible later restoration
|
# Store original command line options for possible later restoration
|
||||||
cmdLineOptions.update(cmdLineParser().__dict__)
|
cmdLineOptions.update(options.__dict__)
|
||||||
|
|
||||||
init(cmdLineOptions)
|
init(cmdLineOptions)
|
||||||
|
|
||||||
|
|
|
@ -872,7 +872,7 @@ def cleanQuery(query):
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def setPaths():
|
def setPaths(options):
|
||||||
"""
|
"""
|
||||||
Sets absolute paths for project directories and files
|
Sets absolute paths for project directories and files
|
||||||
"""
|
"""
|
||||||
|
@ -886,7 +886,10 @@ def setPaths():
|
||||||
paths.SQLMAP_UDF_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "udf")
|
paths.SQLMAP_UDF_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "udf")
|
||||||
paths.SQLMAP_XML_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "xml")
|
paths.SQLMAP_XML_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "xml")
|
||||||
paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner")
|
paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner")
|
||||||
paths.SQLMAP_OUTPUT_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "output")
|
if options.output_dir:
|
||||||
|
paths.SQLMAP_OUTPUT_PATH = options.output_dir
|
||||||
|
else:
|
||||||
|
paths.SQLMAP_OUTPUT_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "output")
|
||||||
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
|
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
|
||||||
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")
|
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")
|
||||||
paths.SQLMAP_SEXEC_PATH = os.path.join(paths.SQLMAP_EXTRAS_PATH, "shellcodeexec")
|
paths.SQLMAP_SEXEC_PATH = os.path.join(paths.SQLMAP_EXTRAS_PATH, "shellcodeexec")
|
||||||
|
|
|
@ -566,6 +566,10 @@ def cmdLineParser():
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Update sqlmap")
|
help="Update sqlmap")
|
||||||
|
|
||||||
|
general.add_option("--output-dir", dest="output_dir",
|
||||||
|
action="store",
|
||||||
|
help="Directory to store output files in.")
|
||||||
|
|
||||||
# Miscellaneous options
|
# Miscellaneous options
|
||||||
miscellaneous = OptionGroup(parser, "Miscellaneous")
|
miscellaneous = OptionGroup(parser, "Miscellaneous")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user