mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Fixes #3637
This commit is contained in:
parent
5ae78b1d85
commit
7a179889a3
|
@ -1800,9 +1800,11 @@ def getFileType(filePath):
|
|||
"""
|
||||
|
||||
try:
|
||||
desc = getUnicode(magic.from_file(filePath) or "")
|
||||
desc = magic.from_file(filePath) or magic.MAGIC_UNKNOWN_FILETYPE
|
||||
except:
|
||||
desc = magic.MAGIC_UNKNOWN_FILETYPE
|
||||
finally:
|
||||
desc = getText(desc)
|
||||
|
||||
if desc == magic.MAGIC_UNKNOWN_FILETYPE:
|
||||
content = openFile(filePath, "rb", encoding=None).read()
|
||||
|
|
|
@ -18,6 +18,7 @@ from lib.core.common import checkFile
|
|||
from lib.core.common import dataToDumpFile
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.common import getText
|
||||
from lib.core.common import isListLike
|
||||
from lib.core.common import isMultiThreadMode
|
||||
from lib.core.common import normalizeUnicode
|
||||
|
@ -613,8 +614,8 @@ class Dump(object):
|
|||
|
||||
if len(value) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value:
|
||||
try:
|
||||
mimetype = magic.from_buffer(value, mime=True)
|
||||
if any(mimetype.startswith(_) for _ in (b"application", b"image")):
|
||||
mimetype = getText(magic.from_buffer(value, mime=True))
|
||||
if any(mimetype.startswith(_) for _ in ("application", "image")):
|
||||
if not os.path.isdir(dumpDbPath):
|
||||
os.makedirs(dumpDbPath)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.5.58"
|
||||
VERSION = "1.3.5.59"
|
||||
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)
|
||||
|
|
2
thirdparty/magic/magic.py
vendored
2
thirdparty/magic/magic.py
vendored
|
@ -223,4 +223,4 @@ MAGIC_NO_CHECK_ASCII = 0x020000 # Don't check for ascii files
|
|||
MAGIC_NO_CHECK_TROFF = 0x040000 # Don't check ascii/troff
|
||||
MAGIC_NO_CHECK_FORTRAN = 0x080000 # Don't check ascii/fortran
|
||||
MAGIC_NO_CHECK_TOKENS = 0x100000 # Don't check ascii/tokens
|
||||
MAGIC_UNKNOWN_FILETYPE = "unknown"
|
||||
MAGIC_UNKNOWN_FILETYPE = b"unknown"
|
Loading…
Reference in New Issue
Block a user