Skip to content

Commit 3ac1283

Browse files
committed
Further pleasing pylint deity
1 parent c154e64 commit 3ac1283

File tree

13 files changed

+41
-17
lines changed

13 files changed

+41
-17
lines changed

lib/controller/controller.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import os
911
import re
1012
import time

lib/core/common.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import binascii
911
import codecs
1012
import collections
@@ -2530,7 +2532,7 @@ def pushValue(value):
25302532
Push value to the stack (thread dependent)
25312533
"""
25322534

2533-
_ = None
2535+
exception = None
25342536
success = False
25352537

25362538
for i in xrange(PUSH_VALUE_EXCEPTION_RETRY_COUNT):
@@ -2539,13 +2541,13 @@ def pushValue(value):
25392541
success = True
25402542
break
25412543
except Exception as ex:
2542-
_ = ex
2544+
exception = ex
25432545

25442546
if not success:
25452547
getCurrentThreadData().valueStack.append(None)
25462548

2547-
if _:
2548-
raise _
2549+
if exception:
2550+
raise exception
25492551

25502552
def popValue():
25512553
"""
@@ -5045,6 +5047,8 @@ def getSafeExString(ex, encoding=None):
50455047
50465048
>>> getSafeExString(SqlmapBaseException('foobar')) == 'foobar'
50475049
True
5050+
>>> getSafeExString(OSError(0, 'foobar')) == 'OSError: foobar'
5051+
True
50485052
"""
50495053

50505054
retVal = None
@@ -5053,10 +5057,11 @@ def getSafeExString(ex, encoding=None):
50535057
retVal = ex.message
50545058
elif getattr(ex, "msg", None):
50555059
retVal = ex.msg
5056-
elif isinstance(ex, (list, tuple)) and len(ex) > 1 and isinstance(ex[1], six.string_types):
5057-
retVal = ex[1]
5058-
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], six.string_types):
5059-
retVal = ex[0]
5060+
elif getattr(ex, "args", None):
5061+
for candidate in ex.args[::-1]:
5062+
if isinstance(candidate, six.string_types):
5063+
retVal = candidate
5064+
break
50605065

50615066
if retVal is None:
50625067
retVal = str(ex)

lib/core/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import binascii
911
import functools
1012
import math

lib/core/option.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import functools
911
import glob
1012
import inspect
@@ -1885,7 +1887,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
18851887
kb.heuristicMode = False
18861888
kb.heuristicPage = False
18871889
kb.heuristicTest = None
1888-
kb.hintValue = None
1890+
kb.hintValue = ""
18891891
kb.htmlFp = []
18901892
kb.httpErrorCodes = {}
18911893
kb.inferenceMode = False

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.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.6.9"
21+
VERSION = "1.3.6.10"
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import errno
911
import os
1012
import subprocess
1113
import time
1214

1315
from lib.core.compat import buffer
1416
from lib.core.settings import IS_WIN
15-
from thirdparty import six
1617

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

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

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

lib/core/testing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import codecs
911
import doctest
1012
import logging

lib/request/comparison.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import re
911

1012
from lib.core.common import extractRegexResult

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] if six.PY2 else ex.errno) == errno.EINTR:
601+
if ex.args[0] == errno.EINTR:
602602
continue
603603
else:
604604
return proc.returncode

lib/techniques/blind/inference.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from __future__ import division
9+
810
import re
911
import threading
1012
import time
@@ -196,7 +198,7 @@ def tryHint(idx):
196198
with hintlock:
197199
hintValue = kb.hintValue
198200

199-
if payload is not None and hintValue is not None and len(hintValue) >= idx:
201+
if payload is not None and len(hintValue or "") > 0 and len(hintValue) >= idx:
200202
if Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.ACCESS, DBMS.MAXDB, DBMS.DB2):
201203
posValue = hintValue[idx - 1]
202204
else:
@@ -213,7 +215,7 @@ def tryHint(idx):
213215
return hintValue[idx - 1]
214216

215217
with hintlock:
216-
kb.hintValue = None
218+
kb.hintValue = ""
217219

218220
return None
219221

0 commit comments

Comments
 (0)