From 7bc0b08fd6c51f0880c3849f98c76954864beba1 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 21 Nov 2022 00:03:36 +0100 Subject: [PATCH] Implementing option '--dump-file' (#5238) --- lib/core/dump.py | 2 +- lib/core/optiondict.py | 1 + lib/core/settings.py | 2 +- lib/parse/cmdline.py | 3 +++ sqlmap.conf | 3 +++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index d155ebae1..308849704 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -449,7 +449,7 @@ class Dump(object): dumpDbPath = tempDir - dumpFileName = os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))) + dumpFileName = conf.dumpFile or os.path.join(dumpDbPath, re.sub(r'[\\/]', UNSAFE_DUMP_FILEPATH_REPLACEMENT, "%s.%s" % (unsafeSQLIdentificatorNaming(table), conf.dumpFormat.lower()))) if not checkFile(dumpFileName, False): try: openFile(dumpFileName, "w+b").close() diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 8dc37e262..573361b92 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -215,6 +215,7 @@ optDict = { "crawlDepth": "integer", "crawlExclude": "string", "csvDel": "string", + "dumpFile": "string", "dumpFormat": "string", "encoding": "string", "eta": "boolean", diff --git a/lib/core/settings.py b/lib/core/settings.py index 727ecb022..ef159b1ab 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty import six from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.6.11.3" +VERSION = "1.6.11.4" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 11e4cff94..004e695fa 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -661,6 +661,9 @@ def cmdLineParser(argv=None): general.add_argument("--charset", dest="charset", help="Blind SQL injection charset (e.g. \"0123456789abcdef\")") + general.add_argument("--dump-file", dest="dumpFile", + help="Store dumped data to a custom file") + general.add_argument("--dump-format", dest="dumpFormat", help="Format of dumped data (CSV (default), HTML or SQLITE)") diff --git a/sqlmap.conf b/sqlmap.conf index 8af1dd903..ecab1a5c5 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -738,6 +738,9 @@ crawlExclude = # Default: , csvDel = , +# Store dumped data to a custom file. +dumpFile = + # Format of dumped data # Valid: CSV, HTML or SQLITE dumpFormat = CSV