Further pleasing pylint deity

This commit is contained in:
Miroslav Stampar 2019-06-04 12:15:39 +02:00
parent c154e64a19
commit 3ac1283900
13 changed files with 41 additions and 17 deletions

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import os
import re
import time

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import binascii
import codecs
import collections
@ -2530,7 +2532,7 @@ def pushValue(value):
Push value to the stack (thread dependent)
"""
_ = None
exception = None
success = False
for i in xrange(PUSH_VALUE_EXCEPTION_RETRY_COUNT):
@ -2539,13 +2541,13 @@ def pushValue(value):
success = True
break
except Exception as ex:
_ = ex
exception = ex
if not success:
getCurrentThreadData().valueStack.append(None)
if _:
raise _
if exception:
raise exception
def popValue():
"""
@ -5045,6 +5047,8 @@ def getSafeExString(ex, encoding=None):
>>> getSafeExString(SqlmapBaseException('foobar')) == 'foobar'
True
>>> getSafeExString(OSError(0, 'foobar')) == 'OSError: foobar'
True
"""
retVal = None
@ -5053,10 +5057,11 @@ def getSafeExString(ex, encoding=None):
retVal = ex.message
elif getattr(ex, "msg", None):
retVal = ex.msg
elif isinstance(ex, (list, tuple)) and len(ex) > 1 and isinstance(ex[1], six.string_types):
retVal = ex[1]
elif isinstance(ex, (list, tuple)) and len(ex) > 0 and isinstance(ex[0], six.string_types):
retVal = ex[0]
elif getattr(ex, "args", None):
for candidate in ex.args[::-1]:
if isinstance(candidate, six.string_types):
retVal = candidate
break
if retVal is None:
retVal = str(ex)

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import binascii
import functools
import math

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import functools
import glob
import inspect
@ -1885,7 +1887,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.heuristicMode = False
kb.heuristicPage = False
kb.heuristicTest = None
kb.hintValue = None
kb.hintValue = ""
kb.htmlFp = []
kb.httpErrorCodes = {}
kb.inferenceMode = False

View File

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

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import errno
import os
import subprocess
@ -12,7 +14,6 @@ import time
from lib.core.compat import buffer
from lib.core.settings import IS_WIN
from thirdparty import six
if IS_WIN:
try:
@ -98,7 +99,7 @@ class Popen(subprocess.Popen):
except ValueError:
return self._close('stdin')
except (subprocess.pywintypes.error, Exception) as ex:
if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
if ex.args[0] in (109, errno.ESHUTDOWN):
return self._close('stdin')
raise
@ -119,7 +120,7 @@ class Popen(subprocess.Popen):
except (ValueError, NameError):
return self._close(which)
except (subprocess.pywintypes.error, Exception) as ex:
if (ex[0] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN):
if ex.args[0] in (109, errno.ESHUTDOWN):
return self._close(which)
raise
@ -137,7 +138,7 @@ class Popen(subprocess.Popen):
try:
written = os.write(self.stdin.fileno(), input)
except OSError as ex:
if (ex[0] if six.PY2 else ex.errno) == errno.EPIPE: # broken pipe
if ex.args[0] == errno.EPIPE: # broken pipe
return self._close('stdin')
raise

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import codecs
import doctest
import logging

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import re
from lib.core.common import extractRegexResult

View File

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

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import re
import threading
import time
@ -196,7 +198,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
with hintlock:
hintValue = kb.hintValue
if payload is not None and hintValue is not None and len(hintValue) >= idx:
if payload is not None and len(hintValue or "") > 0 and len(hintValue) >= idx:
if Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.ACCESS, DBMS.MAXDB, DBMS.DB2):
posValue = hintValue[idx - 1]
else:
@ -213,7 +215,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
return hintValue[idx - 1]
with hintlock:
kb.hintValue = None
kb.hintValue = ""
return None

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import time
from lib.core.common import clearConsoleLine

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import os
import re
import tempfile

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import division
import time
from lib.core.common import dataToStdout