mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
Minor patches (--purge instead of --purge-output)
This commit is contained in:
parent
4badb54607
commit
5e2d0bd320
|
@ -1273,12 +1273,15 @@ def setPaths(rootPath):
|
||||||
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")
|
||||||
|
|
||||||
|
# history files
|
||||||
|
paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(_, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)
|
||||||
|
paths.API_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "api.hst")
|
||||||
|
paths.OS_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "os.hst")
|
||||||
|
paths.SQL_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "sql.hst")
|
||||||
|
paths.SQLMAP_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "sqlmap.hst")
|
||||||
|
paths.GITHUB_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "github.hst")
|
||||||
|
|
||||||
# sqlmap files
|
# sqlmap files
|
||||||
paths.API_SHELL_HISTORY = os.path.join(_, "api.hst")
|
|
||||||
paths.OS_SHELL_HISTORY = os.path.join(_, "os.hst")
|
|
||||||
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.CHECKSUM_MD5 = os.path.join(paths.SQLMAP_TXT_PATH, "checksum.md5")
|
paths.CHECKSUM_MD5 = os.path.join(paths.SQLMAP_TXT_PATH, "checksum.md5")
|
||||||
paths.COMMON_COLUMNS = os.path.join(paths.SQLMAP_TXT_PATH, "common-columns.txt")
|
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_TABLES = os.path.join(paths.SQLMAP_TXT_PATH, "common-tables.txt")
|
||||||
|
|
|
@ -281,6 +281,7 @@ DEPRECATED_OPTIONS = {
|
||||||
"--auth-private": "use '--auth-file' instead",
|
"--auth-private": "use '--auth-file' instead",
|
||||||
"--ignore-401": "use '--ignore-code' instead",
|
"--ignore-401": "use '--ignore-code' instead",
|
||||||
"--second-order": "use '--second-url' instead",
|
"--second-order": "use '--second-url' instead",
|
||||||
|
"--purge-output": "use '--purge' instead",
|
||||||
"--check-payload": None,
|
"--check-payload": None,
|
||||||
"--check-waf": None,
|
"--check-waf": None,
|
||||||
"--pickled-options": "use '--api -c ...' instead",
|
"--pickled-options": "use '--api -c ...' instead",
|
||||||
|
|
|
@ -1638,13 +1638,13 @@ def _cleanupEnvironment():
|
||||||
if hasattr(socket, "_ready"):
|
if hasattr(socket, "_ready"):
|
||||||
socket._ready.clear()
|
socket._ready.clear()
|
||||||
|
|
||||||
def _purgeOutput():
|
def _purge():
|
||||||
"""
|
"""
|
||||||
Safely removes (purges) output directory.
|
Safely removes (purges) sqlmap data directory.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if conf.purgeOutput:
|
if conf.purge:
|
||||||
purge(paths.SQLMAP_OUTPUT_PATH)
|
purge(paths.SQLMAP_HOME_PATH)
|
||||||
|
|
||||||
def _setConfAttributes():
|
def _setConfAttributes():
|
||||||
"""
|
"""
|
||||||
|
@ -2450,7 +2450,7 @@ def init():
|
||||||
_setRequestFromFile()
|
_setRequestFromFile()
|
||||||
_cleanupOptions()
|
_cleanupOptions()
|
||||||
_cleanupEnvironment()
|
_cleanupEnvironment()
|
||||||
_purgeOutput()
|
_purge()
|
||||||
_checkDependencies()
|
_checkDependencies()
|
||||||
_createTemporaryDirectory()
|
_createTemporaryDirectory()
|
||||||
_basicOptionValidation()
|
_basicOptionValidation()
|
||||||
|
|
|
@ -229,7 +229,7 @@ optDict = {
|
||||||
"identifyWaf": "boolean",
|
"identifyWaf": "boolean",
|
||||||
"mobile": "boolean",
|
"mobile": "boolean",
|
||||||
"offline": "boolean",
|
"offline": "boolean",
|
||||||
"purgeOutput": "boolean",
|
"purge": "boolean",
|
||||||
"skipWaf": "boolean",
|
"skipWaf": "boolean",
|
||||||
"smart": "boolean",
|
"smart": "boolean",
|
||||||
"tmpDir": "string",
|
"tmpDir": "string",
|
||||||
|
|
|
@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
|
||||||
from lib.core.enums import OS
|
from lib.core.enums import OS
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.2.6.35"
|
VERSION = "1.2.6.36"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -619,33 +619,35 @@ def _createTargetDirs():
|
||||||
Create the output directory.
|
Create the output directory.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
for context in "output", "history":
|
||||||
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
|
directory = paths["SQLMAP_%s_PATH" % context.upper()]
|
||||||
os.makedirs(paths.SQLMAP_OUTPUT_PATH)
|
|
||||||
|
|
||||||
_ = os.path.join(paths.SQLMAP_OUTPUT_PATH, randomStr())
|
|
||||||
open(_, "w+b").close()
|
|
||||||
os.remove(_)
|
|
||||||
|
|
||||||
if conf.outputDir:
|
|
||||||
warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH
|
|
||||||
logger.warn(warnMsg)
|
|
||||||
except (OSError, IOError), ex:
|
|
||||||
try:
|
try:
|
||||||
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
|
if not os.path.isdir(directory):
|
||||||
except Exception, _:
|
os.makedirs(directory)
|
||||||
errMsg = "unable to write to the temporary directory ('%s'). " % _
|
|
||||||
errMsg += "Please make sure that your disk is not full and "
|
|
||||||
errMsg += "that you have sufficient write permissions to "
|
|
||||||
errMsg += "create temporary files and/or directories"
|
|
||||||
raise SqlmapSystemException(errMsg)
|
|
||||||
|
|
||||||
warnMsg = "unable to %s output directory " % ("create" if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH) else "write to the")
|
_ = os.path.join(directory, randomStr())
|
||||||
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, getUnicode(ex))
|
open(_, "w+b").close()
|
||||||
warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)
|
os.remove(_)
|
||||||
logger.warn(warnMsg)
|
|
||||||
|
|
||||||
paths.SQLMAP_OUTPUT_PATH = tempDir
|
if conf.outputDir and context == "output":
|
||||||
|
warnMsg = "using '%s' as the %s directory" % (directory, context)
|
||||||
|
logger.warn(warnMsg)
|
||||||
|
except (OSError, IOError), ex:
|
||||||
|
try:
|
||||||
|
tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context)
|
||||||
|
except Exception, _:
|
||||||
|
errMsg = "unable to write to the temporary directory ('%s'). " % _
|
||||||
|
errMsg += "Please make sure that your disk is not full and "
|
||||||
|
errMsg += "that you have sufficient write permissions to "
|
||||||
|
errMsg += "create temporary files and/or directories"
|
||||||
|
raise SqlmapSystemException(errMsg)
|
||||||
|
|
||||||
|
warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context)
|
||||||
|
warnMsg += "'%s' (%s). " % (directory, getUnicode(ex))
|
||||||
|
warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)
|
||||||
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
|
paths["SQLMAP_%s_PATH" % context.upper()] = tempDir
|
||||||
|
|
||||||
conf.outputPath = os.path.join(getUnicode(paths.SQLMAP_OUTPUT_PATH), normalizeUnicode(getUnicode(conf.hostname)))
|
conf.outputPath = os.path.join(getUnicode(paths.SQLMAP_OUTPUT_PATH), normalizeUnicode(getUnicode(conf.hostname)))
|
||||||
|
|
||||||
|
|
|
@ -643,8 +643,8 @@ def cmdLineParser(argv=None):
|
||||||
miscellaneous.add_option("--offline", dest="offline", action="store_true",
|
miscellaneous.add_option("--offline", dest="offline", action="store_true",
|
||||||
help="Work in offline mode (only use session data)")
|
help="Work in offline mode (only use session data)")
|
||||||
|
|
||||||
miscellaneous.add_option("--purge-output", dest="purgeOutput", action="store_true",
|
miscellaneous.add_option("--purge", dest="purge", action="store_true",
|
||||||
help="Safely remove all content from output directory")
|
help="Safely remove all content from sqlmap data directory")
|
||||||
|
|
||||||
miscellaneous.add_option("--skip-waf", dest="skipWaf", action="store_true",
|
miscellaneous.add_option("--skip-waf", dest="skipWaf", action="store_true",
|
||||||
help="Skip heuristic detection of WAF/IPS/IDS protection")
|
help="Skip heuristic detection of WAF/IPS/IDS protection")
|
||||||
|
@ -874,7 +874,7 @@ def cmdLineParser(argv=None):
|
||||||
if args.dummy:
|
if args.dummy:
|
||||||
args.url = args.url or DUMMY_URL
|
args.url = args.url or DUMMY_URL
|
||||||
|
|
||||||
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.liveTest, args.wizard, args.dependencies, args.purgeOutput, args.sitemapUrl)):
|
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.liveTest, args.wizard, args.dependencies, args.purge, args.sitemapUrl)):
|
||||||
errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, -x, --wizard, --update, --purge-output or --dependencies), "
|
errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, -x, --wizard, --update, --purge-output or --dependencies), "
|
||||||
errMsg += "use -h for basic or -hh for advanced help\n"
|
errMsg += "use -h for basic or -hh for advanced help\n"
|
||||||
parser.error(errMsg)
|
parser.error(errMsg)
|
||||||
|
|
|
@ -28,30 +28,30 @@ c7443613a0a2505b1faec931cee2a6ef lib/controller/handler.py
|
||||||
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
|
1e5532ede194ac9c083891c2f02bca93 lib/controller/__init__.py
|
||||||
0adf547455a76dc71e6a599e52da1ed9 lib/core/agent.py
|
0adf547455a76dc71e6a599e52da1ed9 lib/core/agent.py
|
||||||
fd8f239e259afaf5f24bcf34a0ad187f lib/core/bigarray.py
|
fd8f239e259afaf5f24bcf34a0ad187f lib/core/bigarray.py
|
||||||
6165b8a826803b29c479d47a60e8dbf6 lib/core/common.py
|
acec51826b280ad96dedbb56515e3988 lib/core/common.py
|
||||||
0d082da16c388b3445e656e0760fb582 lib/core/convert.py
|
0d082da16c388b3445e656e0760fb582 lib/core/convert.py
|
||||||
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
|
9f87391b6a3395f7f50830b391264f27 lib/core/data.py
|
||||||
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
|
72016ea5c994a711a262fd64572a0fcd lib/core/datatype.py
|
||||||
4086fb55f42e27de5330505605baad0f lib/core/decorators.py
|
4086fb55f42e27de5330505605baad0f lib/core/decorators.py
|
||||||
fbb55cc6100318ff922957b6577dc58f lib/core/defaults.py
|
fbb55cc6100318ff922957b6577dc58f lib/core/defaults.py
|
||||||
98b730cef6a59ab044a108276aef6f42 lib/core/dicts.py
|
db165596ef0a3e19ec59c24192bb318d lib/core/dicts.py
|
||||||
9ea8a043030796e6faef7f7e957729d5 lib/core/dump.py
|
9ea8a043030796e6faef7f7e957729d5 lib/core/dump.py
|
||||||
ab3f4f3e3019add5f4a2e28f7e8748a4 lib/core/enums.py
|
ab3f4f3e3019add5f4a2e28f7e8748a4 lib/core/enums.py
|
||||||
cada93357a7321655927fc9625b3bfec lib/core/exception.py
|
cada93357a7321655927fc9625b3bfec lib/core/exception.py
|
||||||
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
|
1e5532ede194ac9c083891c2f02bca93 lib/core/__init__.py
|
||||||
458a194764805cd8312c14ecd4be4d1e lib/core/log.py
|
458a194764805cd8312c14ecd4be4d1e lib/core/log.py
|
||||||
e9e32e5afe49ecd644b3a0ca9c9a36fc lib/core/optiondict.py
|
13c0a490b5a928b64236b4a15e578267 lib/core/optiondict.py
|
||||||
5d25911fbd379c32d5bf918c79febc0b lib/core/option.py
|
4ef6c718b5069f7468c647b5e29fd3db lib/core/option.py
|
||||||
c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
|
c8c386d644d57c659d74542f5f57f632 lib/core/patch.py
|
||||||
6783160150b4711d02c56ee2beadffdb lib/core/profiling.py
|
6783160150b4711d02c56ee2beadffdb lib/core/profiling.py
|
||||||
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
|
6f654e1715571eff68a0f8af3d62dcf8 lib/core/readlineng.py
|
||||||
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
|
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
|
||||||
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
|
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
|
||||||
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
|
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
|
||||||
4742105fe7dd3964e11961c44cf9e851 lib/core/settings.py
|
770a509eb586d686c1ca318171d17a33 lib/core/settings.py
|
||||||
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
|
dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py
|
||||||
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
|
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
|
||||||
36bd2dc292c0e10e39bd9c43b77fe1bc lib/core/target.py
|
95f04c1c1d8c3998d86e1bdf0e12771c lib/core/target.py
|
||||||
72d499ca8d792e90a1ebfb2ad2341a51 lib/core/testing.py
|
72d499ca8d792e90a1ebfb2ad2341a51 lib/core/testing.py
|
||||||
de9922a29c71a235cb95a916ff925db2 lib/core/threads.py
|
de9922a29c71a235cb95a916ff925db2 lib/core/threads.py
|
||||||
c40758411bb0bd68764d78e0bb72bd0f lib/core/unescaper.py
|
c40758411bb0bd68764d78e0bb72bd0f lib/core/unescaper.py
|
||||||
|
@ -59,7 +59,7 @@ c40758411bb0bd68764d78e0bb72bd0f lib/core/unescaper.py
|
||||||
e772deb63270375e685fa5a7b775c382 lib/core/wordlist.py
|
e772deb63270375e685fa5a7b775c382 lib/core/wordlist.py
|
||||||
1e5532ede194ac9c083891c2f02bca93 lib/__init__.py
|
1e5532ede194ac9c083891c2f02bca93 lib/__init__.py
|
||||||
7620f1f4b8791e13c7184c06b5421754 lib/parse/banner.py
|
7620f1f4b8791e13c7184c06b5421754 lib/parse/banner.py
|
||||||
2b3b021a8e7e119d0553c02b110d07d9 lib/parse/cmdline.py
|
3dd11b8be62e15a9d54cf5f08c603ffc lib/parse/cmdline.py
|
||||||
fb2e2f05dde98caeac6ccf3e67192177 lib/parse/configfile.py
|
fb2e2f05dde98caeac6ccf3e67192177 lib/parse/configfile.py
|
||||||
3794ff139869f5ae8e81cfdbe5714f56 lib/parse/handler.py
|
3794ff139869f5ae8e81cfdbe5714f56 lib/parse/handler.py
|
||||||
6bab53ea9d75bc9bb8169d3e8f3f149f lib/parse/headers.py
|
6bab53ea9d75bc9bb8169d3e8f3f149f lib/parse/headers.py
|
||||||
|
|
Loading…
Reference in New Issue
Block a user