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 See the file 'LICENSE' for copying permission
""" """
from __future__ import division
import os import os
import re import re
import time import time

View File

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

View File

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

View File

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

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
from __future__ import division
import errno import errno
import os import os
import subprocess import subprocess
@ -12,7 +14,6 @@ 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:
@ -98,7 +99,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] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN): if ex.args[0] in (109, errno.ESHUTDOWN):
return self._close('stdin') return self._close('stdin')
raise raise
@ -119,7 +120,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] if six.PY2 else ex.errno) in (109, errno.ESHUTDOWN): if ex.args[0] in (109, errno.ESHUTDOWN):
return self._close(which) return self._close(which)
raise raise
@ -137,7 +138,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] if six.PY2 else ex.errno) == errno.EPIPE: # broken pipe if ex.args[0] == errno.EPIPE: # broken pipe
return self._close('stdin') return self._close('stdin')
raise raise

View File

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

View File

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

View File

@ -598,7 +598,7 @@ class Metasploit(object):
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] if six.PY2 else ex.errno) == errno.EINTR: if ex.args[0] == errno.EINTR:
continue continue
else: else:
return proc.returncode 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 See the file 'LICENSE' for copying permission
""" """
from __future__ import division
import re import re
import threading import threading
import time import time
@ -196,7 +198,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
with hintlock: with hintlock:
hintValue = kb.hintValue 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): if Backend.getIdentifiedDbms() in (DBMS.SQLITE, DBMS.ACCESS, DBMS.MAXDB, DBMS.DB2):
posValue = hintValue[idx - 1] posValue = hintValue[idx - 1]
else: else:
@ -213,7 +215,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
return hintValue[idx - 1] return hintValue[idx - 1]
with hintlock: with hintlock:
kb.hintValue = None kb.hintValue = ""
return None return None

View File

@ -5,6 +5,8 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
from __future__ import division
import time import time
from lib.core.common import clearConsoleLine 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 See the file 'LICENSE' for copying permission
""" """
from __future__ import division
import os import os
import re import re
import tempfile import tempfile

View File

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