Couple of DREI patches

This commit is contained in:
Miroslav Stampar 2019-05-07 16:37:32 +02:00
parent 2e75662a6d
commit 2b57b4b54b
6 changed files with 10 additions and 11 deletions

View File

@ -614,7 +614,7 @@ class Dump(object):
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:
try: try:
mimetype = magic.from_buffer(value, mime=True) mimetype = magic.from_buffer(value, mime=True)
if any(mimetype.startswith(_) for _ in ("application", "image")): if any(mimetype.startswith(_) for _ in (b"application", b"image")):
if not os.path.isdir(dumpDbPath): if not os.path.isdir(dumpDbPath):
os.makedirs(dumpDbPath) os.makedirs(dumpDbPath)

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty import six from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.5.39" VERSION = "1.3.5.40"
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)

View File

@ -12,6 +12,7 @@ import time
from lib.core.compat import buffer from lib.core.compat import buffer
from lib.core.settings import IS_WIN from lib.core.settings import IS_WIN
from thirdparty import six
if IS_WIN: if IS_WIN:
try: try:
@ -97,7 +98,7 @@ class Popen(subprocess.Popen):
except ValueError: except ValueError:
return self._close('stdin') return self._close('stdin')
except (subprocess.pywintypes.error, Exception) as ex: except (subprocess.pywintypes.error, Exception) as ex:
if ex[0] in (109, errno.ESHUTDOWN): if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
return self._close('stdin') return self._close('stdin')
raise raise
@ -118,7 +119,7 @@ class Popen(subprocess.Popen):
except (ValueError, NameError): except (ValueError, NameError):
return self._close(which) return self._close(which)
except (subprocess.pywintypes.error, Exception) as ex: except (subprocess.pywintypes.error, Exception) as ex:
if ex[0] in (109, errno.ESHUTDOWN): if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
return self._close(which) return self._close(which)
raise raise
@ -136,7 +137,7 @@ class Popen(subprocess.Popen):
try: try:
written = os.write(self.stdin.fileno(), input) written = os.write(self.stdin.fileno(), input)
except OSError as ex: except OSError as ex:
if ex[0] == errno.EPIPE: # broken pipe if (ex[0] if six.PY2 else ex.errno) == errno.EPIPE: # broken pipe
return self._close('stdin') return self._close('stdin')
raise raise

View File

@ -598,7 +598,7 @@ class Metasploit:
except select.error as ex: except select.error as ex:
# Reference: https://github.com/andymccurdy/redis-py/pull/743/commits/2b59b25bb08ea09e98aede1b1f23a270fc085a9f # Reference: https://github.com/andymccurdy/redis-py/pull/743/commits/2b59b25bb08ea09e98aede1b1f23a270fc085a9f
if ex[0] == errno.EINTR: if (ex[0] if six.PY2 else ex.errno) == errno.EINTR:
continue continue
else: else:
return proc.returncode return proc.returncode

View File

@ -77,7 +77,7 @@ class SQLAlchemy(GenericConnector):
except SqlmapFilePathException: except SqlmapFilePathException:
raise raise
except Exception as ex: except Exception as ex:
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % ex[0]) raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % ex.msg)
self.printConnected() self.printConnected()
else: else:

View File

@ -31,14 +31,12 @@ class Connector:
def printConnected(self): def printConnected(self):
if self.hostname and self.port: if self.hostname and self.port:
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname) infoMsg = "connection to %s server '%s:%d' established" % (conf.dbms, self.hostname, self.port)
infoMsg += ":%d established" % self.port
logger.info(infoMsg) logger.info(infoMsg)
def closed(self): def closed(self):
if self.hostname and self.port: if self.hostname and self.port:
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname) infoMsg = "connection to %s server '%s:%d' closed" % (conf.dbms, self.hostname, self.port)
infoMsg += ":%d closed" % self.port
logger.info(infoMsg) logger.info(infoMsg)
self.connector = None self.connector = None