Skip to content

Commit 2b57b4b

Browse files
committed
Couple of DREI patches
1 parent 2e75662 commit 2b57b4b

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

lib/core/dump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def dbTableValues(self, tableValues):
614614
if len(value) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value:
615615
try:
616616
mimetype = magic.from_buffer(value, mime=True)
617-
if any(mimetype.startswith(_) for _ in ("application", "image")):
617+
if any(mimetype.startswith(_) for _ in (b"application", b"image")):
618618
if not os.path.isdir(dumpDbPath):
619619
os.makedirs(dumpDbPath)
620620

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty import six
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.39"
21+
VERSION = "1.3.5.40"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/subprocessng.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from lib.core.compat import buffer
1414
from lib.core.settings import IS_WIN
15+
from thirdparty import six
1516

1617
if IS_WIN:
1718
try:
@@ -97,7 +98,7 @@ def send(self, input):
9798
except ValueError:
9899
return self._close('stdin')
99100
except (subprocess.pywintypes.error, Exception) as ex:
100-
if ex[0] in (109, errno.ESHUTDOWN):
101+
if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
101102
return self._close('stdin')
102103
raise
103104

@@ -118,7 +119,7 @@ def _recv(self, which, maxsize):
118119
except (ValueError, NameError):
119120
return self._close(which)
120121
except (subprocess.pywintypes.error, Exception) as ex:
121-
if ex[0] in (109, errno.ESHUTDOWN):
122+
if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
122123
return self._close(which)
123124
raise
124125

@@ -136,7 +137,7 @@ def send(self, input):
136137
try:
137138
written = os.write(self.stdin.fileno(), input)
138139
except OSError as ex:
139-
if ex[0] == errno.EPIPE: # broken pipe
140+
if (ex[0] if six.PY2 else ex.errno) == errno.EPIPE: # broken pipe
140141
return self._close('stdin')
141142
raise
142143

lib/takeover/metasploit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def _controlMsfCmd(self, proc, func):
598598

599599
except select.error as ex:
600600
# Reference: https://github.com/andymccurdy/redis-py/pull/743/commits/2b59b25bb08ea09e98aede1b1f23a270fc085a9f
601-
if ex[0] == errno.EINTR:
601+
if (ex[0] if six.PY2 else ex.errno) == errno.EINTR:
602602
continue
603603
else:
604604
return proc.returncode

lib/utils/sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def connect(self):
7777
except SqlmapFilePathException:
7878
raise
7979
except Exception as ex:
80-
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % ex[0])
80+
raise SqlmapConnectionException("SQLAlchemy connection issue ('%s')" % ex.msg)
8181

8282
self.printConnected()
8383
else:

plugins/generic/connector.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ def initConnection(self):
3131

3232
def printConnected(self):
3333
if self.hostname and self.port:
34-
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname)
35-
infoMsg += ":%d established" % self.port
34+
infoMsg = "connection to %s server '%s:%d' established" % (conf.dbms, self.hostname, self.port)
3635
logger.info(infoMsg)
3736

3837
def closed(self):
3938
if self.hostname and self.port:
40-
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname)
41-
infoMsg += ":%d closed" % self.port
39+
infoMsg = "connection to %s server '%s:%d' closed" % (conf.dbms, self.hostname, self.port)
4240
logger.info(infoMsg)
4341

4442
self.connector = None

0 commit comments

Comments
 (0)