mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-05 08:13:46 +03:00
catch ImportError exception if libmagic is not installed
This commit is contained in:
parent
128597ee7e
commit
259b345f1f
|
@ -159,10 +159,6 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
|
|
||||||
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(origExpr)
|
_, _, _, _, _, expressionFieldsList, expressionFields, _ = agent.getFields(origExpr)
|
||||||
|
|
||||||
if expressionFieldsList and len(expressionFieldsList) > 1 and " ORDER BY " in expression.upper():
|
|
||||||
# No need for it in multicolumn dumps (one row is retrieved per request) and just slowing down on large table dumps
|
|
||||||
expression = expression[:expression.upper().rindex(" ORDER BY ")]
|
|
||||||
|
|
||||||
# We have to check if the SQL query might return multiple entries
|
# We have to check if the SQL query might return multiple entries
|
||||||
# if the technique is partial UNION query and in such case forge the
|
# if the technique is partial UNION query and in such case forge the
|
||||||
# SQL limiting the query output one entry at a time
|
# SQL limiting the query output one entry at a time
|
||||||
|
@ -305,7 +301,7 @@ def unionUse(expression, unpack=True, dump=False):
|
||||||
kb.suppressResumeInfo = False
|
kb.suppressResumeInfo = False
|
||||||
|
|
||||||
if not value and not abortedFlag:
|
if not value and not abortedFlag:
|
||||||
expression = re.sub("\s*ORDER BY\s+[\w,]+", "", expression, re.I) # full union doesn't play well with ORDER BY
|
expression = re.sub("\s*ORDER BY\s+[\w,]+", "", expression, re.I) # full union does not play well with ORDER BY
|
||||||
value = _oneShotUnionUse(expression, unpack)
|
value = _oneShotUnionUse(expression, unpack)
|
||||||
|
|
||||||
duration = calculateDeltaSeconds(start)
|
duration = calculateDeltaSeconds(start)
|
||||||
|
|
5
thirdparty/magic/magic.py
vendored
5
thirdparty/magic/magic.py
vendored
|
@ -106,7 +106,7 @@ def from_buffer(buffer, mime=False):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
libmagic = None
|
libmagic = None
|
||||||
# Let's try to find magic or magic1
|
# Let's try to find magic or magic1
|
||||||
dll = ctypes.util.find_library('magic') or ctypes.util.find_library('magic1')
|
dll = ctypes.util.find_library('magic') or ctypes.util.find_library('magic1')
|
||||||
|
@ -198,7 +198,8 @@ magic_check.argtypes = [magic_t, c_char_p]
|
||||||
magic_compile = libmagic.magic_compile
|
magic_compile = libmagic.magic_compile
|
||||||
magic_compile.restype = c_int
|
magic_compile.restype = c_int
|
||||||
magic_compile.argtypes = [magic_t, c_char_p]
|
magic_compile.argtypes = [magic_t, c_char_p]
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
MAGIC_NONE = 0x000000 # No flags
|
MAGIC_NONE = 0x000000 # No flags
|
||||||
|
|
Loading…
Reference in New Issue
Block a user