mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-18 04:20:35 +03:00
Fix for an Issue #532
This commit is contained in:
parent
1f2e5a91b5
commit
45c88b36c6
|
@ -525,18 +525,21 @@ class Dump(object):
|
||||||
self._write("| %s%s" % (value, blank), newline=False, console=console)
|
self._write("| %s%s" % (value, blank), newline=False, console=console)
|
||||||
|
|
||||||
if len(value) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value:
|
if len(value) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value:
|
||||||
mimetype = magic.from_buffer(value, mime=True)
|
try:
|
||||||
if any(mimetype.startswith(_) for _ in ("application", "image")):
|
mimetype = magic.from_buffer(value, mime=True)
|
||||||
if not os.path.isdir(dumpDbPath):
|
if any(mimetype.startswith(_) for _ in ("application", "image")):
|
||||||
os.makedirs(dumpDbPath, 0755)
|
if not os.path.isdir(dumpDbPath):
|
||||||
|
os.makedirs(dumpDbPath, 0755)
|
||||||
|
|
||||||
filepath = os.path.join(dumpDbPath, "%s-%d.bin" % (unsafeSQLIdentificatorNaming(column), randomInt(8)))
|
filepath = os.path.join(dumpDbPath, "%s-%d.bin" % (unsafeSQLIdentificatorNaming(column), randomInt(8)))
|
||||||
warnMsg = "writing binary ('%s') content to file '%s' " % (mimetype, filepath)
|
warnMsg = "writing binary ('%s') content to file '%s' " % (mimetype, filepath)
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
with open(filepath, "wb") as f:
|
with open(filepath, "wb") as f:
|
||||||
_ = safechardecode(value, True)
|
_ = safechardecode(value, True)
|
||||||
f.write(_)
|
f.write(_)
|
||||||
|
except magic.MagicException, err:
|
||||||
|
logger.debug(str(err))
|
||||||
|
|
||||||
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
if conf.dumpFormat == DUMP_FORMAT.CSV:
|
||||||
if field == fields:
|
if field == fields:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user