Pleasing the pylint gods

This commit is contained in:
Miroslav Stampar 2019-05-29 16:42:04 +02:00
parent 95560da7c1
commit 4077cd2342
25 changed files with 74 additions and 75 deletions

View File

@ -172,9 +172,9 @@ class Agent(object):
if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER):
_ = "%s%s" % (origValue, kb.customInjectionMark)
if kb.postHint == POST_HINT.JSON and not isNumber(newValue) and not '"%s"' % _ in paramString:
if kb.postHint == POST_HINT.JSON and not isNumber(newValue) and '"%s"' % _ not in paramString:
newValue = '"%s"' % newValue
elif kb.postHint == POST_HINT.JSON_LIKE and not isNumber(newValue) and not "'%s'" % _ in paramString:
elif kb.postHint == POST_HINT.JSON_LIKE and not isNumber(newValue) and "'%s'" % _ not in paramString:
newValue = "'%s'" % newValue
newValue = newValue.replace(kb.customInjectionMark, REPLACEMENT_MARKER)
retVal = paramString.replace(_, self.addPayloadDelimiters(newValue))

View File

@ -328,8 +328,7 @@ class Format(object):
else:
return infoStr.lstrip()
class Backend:
# Set methods
class Backend(object):
@staticmethod
def setDbms(dbms):
dbms = aliasToDbmsEnum(dbms)
@ -3547,7 +3546,7 @@ def checkIntegrity():
retVal = True
baseTime = os.path.getmtime(paths.SQLMAP_SETTINGS_PATH) + 3600 # First hour free parking :)
for root, dirnames, filenames in os.walk(paths.SQLMAP_ROOT_PATH):
for root, _, filenames in os.walk(paths.SQLMAP_ROOT_PATH):
for filename in filenames:
if re.search(r"(\.py|\.xml|_)\Z", filename):
filepath = os.path.join(root, filename)

View File

@ -110,7 +110,7 @@ class WichmannHill(random.Random):
period.
"""
if not n >= 0:
if n < 0:
raise ValueError("n must be >= 0")
x, y, z = self._seed
x = int(x * pow(171, n, 30269)) % 30269

View File

@ -5,7 +5,7 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
class PRIORITY:
class PRIORITY(object):
LOWEST = -100
LOWER = -50
LOW = -10
@ -14,7 +14,7 @@ class PRIORITY:
HIGHER = 50
HIGHEST = 100
class SORT_ORDER:
class SORT_ORDER(object):
FIRST = 0
SECOND = 1
THIRD = 2
@ -23,7 +23,7 @@ class SORT_ORDER:
LAST = 100
# Reference: https://docs.python.org/2/library/logging.html#logging-levels
class LOGGING_LEVELS:
class LOGGING_LEVELS(object):
NOTSET = 0
DEBUG = 10
INFO = 20
@ -31,7 +31,7 @@ class LOGGING_LEVELS:
ERROR = 40
CRITICAL = 50
class DBMS:
class DBMS(object):
ACCESS = "Microsoft Access"
DB2 = "IBM DB2"
FIREBIRD = "Firebird"
@ -46,7 +46,7 @@ class DBMS:
H2 = "H2"
INFORMIX = "Informix"
class DBMS_DIRECTORY_NAME:
class DBMS_DIRECTORY_NAME(object):
ACCESS = "access"
DB2 = "db2"
FIREBIRD = "firebird"
@ -61,16 +61,16 @@ class DBMS_DIRECTORY_NAME:
H2 = "h2"
INFORMIX = "informix"
class CUSTOM_LOGGING:
class CUSTOM_LOGGING(object):
PAYLOAD = 9
TRAFFIC_OUT = 8
TRAFFIC_IN = 7
class OS:
class OS(object):
LINUX = "Linux"
WINDOWS = "Windows"
class PLACE:
class PLACE(object):
GET = "GET"
POST = "POST"
URI = "URI"
@ -81,7 +81,7 @@ class PLACE:
CUSTOM_POST = "(custom) POST"
CUSTOM_HEADER = "(custom) HEADER"
class POST_HINT:
class POST_HINT(object):
SOAP = "SOAP"
JSON = "JSON"
JSON_LIKE = "JSON-like"
@ -89,7 +89,7 @@ class POST_HINT:
XML = "XML (generic)"
ARRAY_LIKE = "Array-like"
class HTTPMETHOD:
class HTTPMETHOD(object):
GET = "GET"
POST = "POST"
HEAD = "HEAD"
@ -100,28 +100,28 @@ class HTTPMETHOD:
CONNECT = "CONNECT"
PATCH = "PATCH"
class NULLCONNECTION:
class NULLCONNECTION(object):
HEAD = "HEAD"
RANGE = "Range"
SKIP_READ = "skip-read"
class REFLECTIVE_COUNTER:
class REFLECTIVE_COUNTER(object):
MISS = "MISS"
HIT = "HIT"
class CHARSET_TYPE:
class CHARSET_TYPE(object):
BINARY = 1
DIGITS = 2
HEXADECIMAL = 3
ALPHA = 4
ALPHANUM = 5
class HEURISTIC_TEST:
class HEURISTIC_TEST(object):
CASTED = 1
NEGATIVE = 2
POSITIVE = 3
class HASH:
class HASH(object):
MYSQL = r'(?i)\A\*[0-9a-f]{40}\Z'
MYSQL_OLD = r'(?i)\A(?![0-9]+\Z)[0-9a-f]{16}\Z'
POSTGRES = r'(?i)\Amd5[0-9a-f]{32}\Z'
@ -155,7 +155,7 @@ class HASH:
SHA512_BASE64 = r'\A[a-zA-Z0-9+/]{86}==\Z'
# Reference: http://www.zytrax.com/tech/web/mobile_ids.html
class MOBILES:
class MOBILES(object):
BLACKBERRY = ("BlackBerry Z10", "Mozilla/5.0 (BB10; Kbd) AppleWebKit/537.35+ (KHTML, like Gecko) Version/10.3.3.2205 Mobile Safari/537.35+")
GALAXY = ("Samsung Galaxy S7", "Mozilla/5.0 (Linux; Android 7.0; SM-G930V Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36")
HP = ("HP iPAQ 6365", "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)")
@ -168,23 +168,23 @@ class MOBILES:
PIXEL = ("Google Pixel", "Mozilla/5.0 (Linux; Android 8.0.0; Pixel Build/OPR3.170623.013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36")
XIAOMI = ("Xiaomi Mi 3", "Mozilla/5.0 (Linux; U; Android 4.4.4; en-gb; MI 3W Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36 XiaoMi/MiuiBrowser/2.1.1")
class PROXY_TYPE:
class PROXY_TYPE(object):
HTTP = "HTTP"
HTTPS = "HTTPS"
SOCKS4 = "SOCKS4"
SOCKS5 = "SOCKS5"
class REGISTRY_OPERATION:
class REGISTRY_OPERATION(object):
READ = "read"
ADD = "add"
DELETE = "delete"
class DUMP_FORMAT:
class DUMP_FORMAT(object):
CSV = "CSV"
HTML = "HTML"
SQLITE = "SQLITE"
class HTTP_HEADER:
class HTTP_HEADER(object):
ACCEPT = "Accept"
ACCEPT_CHARSET = "Accept-Charset"
ACCEPT_ENCODING = "Accept-Encoding"
@ -217,17 +217,17 @@ class HTTP_HEADER:
X_POWERED_BY = "X-Powered-By"
X_DATA_ORIGIN = "X-Data-Origin"
class EXPECTED:
class EXPECTED(object):
BOOL = "bool"
INT = "int"
class OPTION_TYPE:
class OPTION_TYPE(object):
BOOLEAN = "boolean"
INTEGER = "integer"
FLOAT = "float"
STRING = "string"
class HASHDB_KEYS:
class HASHDB_KEYS(object):
DBMS = "DBMS"
DBMS_FORK = "DBMS_FORK"
CHECK_WAF_RESULT = "CHECK_WAF_RESULT"
@ -243,11 +243,11 @@ class HASHDB_KEYS:
KB_XP_CMDSHELL_AVAILABLE = "KB_XP_CMDSHELL_AVAILABLE"
OS = "OS"
class REDIRECTION:
class REDIRECTION(object):
YES = "Y"
NO = "N"
class PAYLOAD:
class PAYLOAD(object):
SQLINJECTION = {
1: "boolean-based blind",
2: "error-based",
@ -286,13 +286,13 @@ class PAYLOAD:
9: "Pre-WHERE (non-query)",
}
class METHOD:
class METHOD(object):
COMPARISON = "comparison"
GREP = "grep"
TIME = "time"
UNION = "union"
class TECHNIQUE:
class TECHNIQUE(object):
BOOLEAN = 1
ERROR = 2
QUERY = 3
@ -300,28 +300,28 @@ class PAYLOAD:
TIME = 5
UNION = 6
class WHERE:
class WHERE(object):
ORIGINAL = 1
NEGATIVE = 2
REPLACE = 3
class WIZARD:
class WIZARD(object):
BASIC = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba")
INTERMEDIATE = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getUsers", "getDbs", "getTables", "getSchema", "excludeSysDbs")
ALL = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getHostname", "getUsers", "getPasswordHashes", "getPrivileges", "getRoles", "dumpAll")
class ADJUST_TIME_DELAY:
class ADJUST_TIME_DELAY(object):
DISABLE = -1
NO = 0
YES = 1
class WEB_PLATFORM:
class WEB_PLATFORM(object):
PHP = "php"
ASP = "asp"
ASPX = "aspx"
JSP = "jsp"
class CONTENT_TYPE:
class CONTENT_TYPE(object):
TARGET = 0
TECHNIQUES = 1
DBMS_FINGERPRINT = 2
@ -350,26 +350,26 @@ class CONTENT_TYPE:
REG_READ = 25
STATEMENTS = 26
class CONTENT_STATUS:
class CONTENT_STATUS(object):
IN_PROGRESS = 0
COMPLETE = 1
class AUTH_TYPE:
class AUTH_TYPE(object):
BASIC = "basic"
DIGEST = "digest"
NTLM = "ntlm"
PKI = "pki"
class AUTOCOMPLETE_TYPE:
class AUTOCOMPLETE_TYPE(object):
SQL = 0
OS = 1
SQLMAP = 2
API = 3
class NOTE:
class NOTE(object):
FALSE_POSITIVE_OR_UNEXPLOITABLE = "false positive or unexploitable"
class MKSTEMP_PREFIX:
class MKSTEMP_PREFIX(object):
HASHES = "sqlmaphashes-"
CRAWLER = "sqlmapcrawler-"
IPC = "sqlmapipc-"
@ -381,11 +381,11 @@ class MKSTEMP_PREFIX:
SPECIFIC_RESPONSE = "sqlmapresponse-"
PREPROCESS = "sqlmappreprocess-"
class TIMEOUT_STATE:
class TIMEOUT_STATE(object):
NORMAL = 0
EXCEPTION = 1
TIMEOUT = 2
class HINT:
class HINT(object):
PREPEND = 0
APPEND = 1

View File

@ -32,7 +32,7 @@ class Replication(object):
errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
raise SqlmapConnectionException(errMsg)
class DataType:
class DataType(object):
"""
Using this class we define auxiliary objects
used for representing sqlite data types.
@ -47,7 +47,7 @@ class Replication(object):
def __repr__(self):
return "<DataType: %s>" % self
class Table:
class Table(object):
"""
This class defines methods used to manipulate table objects.
"""

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.5.152"
VERSION = "1.3.5.153"
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

@ -94,7 +94,7 @@ class Popen(subprocess.Popen):
try:
x = msvcrt.get_osfhandle(self.stdin.fileno())
(errCode, written) = WriteFile(x, input)
(_, written) = WriteFile(x, input)
except ValueError:
return self._close('stdin')
except (subprocess.pywintypes.error, Exception) as ex:
@ -111,11 +111,11 @@ class Popen(subprocess.Popen):
try:
x = msvcrt.get_osfhandle(conn.fileno())
(read, nAvail, nMessage) = PeekNamedPipe(x, 0)
(read, nAvail, _) = PeekNamedPipe(x, 0)
if maxsize < nAvail:
nAvail = maxsize
if nAvail > 0:
(errCode, read) = ReadFile(x, nAvail, None)
(_, read) = ReadFile(x, nAvail, None)
except (ValueError, NameError):
return self._close(which)
except (subprocess.pywintypes.error, Exception) as ex:

View File

@ -169,7 +169,7 @@ def smokeTest():
logger.setLevel(logging.CRITICAL)
kb.smokeMode = True
(failure_count, test_count) = doctest.testmod(module)
(failure_count, _) = doctest.testmod(module)
kb.smokeMode = False
logger.setLevel(logging.INFO)

View File

@ -22,7 +22,7 @@ from lib.core.data import logger
from lib.core.data import paths
from lib.core.exception import SqlmapDataException
class ICMPsh:
class ICMPsh(object):
"""
This class defines methods to call icmpsh for plugins.
"""

View File

@ -53,7 +53,7 @@ from thirdparty import six
if IS_WIN:
import msvcrt
class Metasploit:
class Metasploit(object):
"""
This class defines methods to call Metasploit for plugins.
"""

View File

@ -12,7 +12,7 @@ from lib.core.data import conf
from lib.core.data import logger
from lib.core.enums import REGISTRY_OPERATION
class Registry:
class Registry(object):
"""
This class defines methods to read and write Windows registry keys
"""

View File

@ -29,7 +29,7 @@ from lib.core.exception import SqlmapUserQuitException
from lib.core.unescaper import unescaper
from lib.request import inject
class UDF:
class UDF(object):
"""
This class defines methods to deal with User-Defined Functions for
plugins.

View File

@ -56,7 +56,7 @@ from lib.core.settings import VIEWSTATE_REGEX
from lib.request.connect import Connect as Request
from thirdparty.six.moves import urllib as _urllib
class Web:
class Web(object):
"""
This class defines web-oriented OS takeover functionalities for
plugins.

View File

@ -35,7 +35,7 @@ from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.core.threads import getCurrentThreadData
from lib.request import inject
class XP_cmdshell:
class XP_cmdshell(object):
"""
This class defines methods to deal with Microsoft SQL Server
xp_cmdshell extended procedure for plugins.

View File

@ -21,14 +21,14 @@ from thirdparty.six.moves import http_client as _http_client
# Reference: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HAR/Overview.html
# http://www.softwareishard.com/har/viewer/
class HTTPCollectorFactory:
class HTTPCollectorFactory(object):
def __init__(self, harFile=False):
self.harFile = harFile
def create(self):
return HTTPCollector()
class HTTPCollector:
class HTTPCollector(object):
def __init__(self):
self.messages = BigArray()
self.extendedArguments = {}
@ -48,7 +48,7 @@ class HTTPCollector:
"entries": [pair.toEntry().toDict() for pair in self.messages],
}}
class RawPair:
class RawPair(object):
def __init__(self, request, response, startTime=None, endTime=None, extendedArguments=None):
self.request = getBytes(request)
self.response = getBytes(response)
@ -61,7 +61,7 @@ class RawPair:
startTime=self.startTime, endTime=self.endTime,
extendedArguments=self.extendedArguments)
class Entry:
class Entry(object):
def __init__(self, request, response, startTime, endTime, extendedArguments):
self.request = request
self.response = response
@ -85,7 +85,7 @@ class Entry:
out.update(self.extendedArguments)
return out
class Request:
class Request(object):
def __init__(self, method, path, httpVersion, headers, postBody=None, raw=None, comment=None):
self.method = method
self.path = path
@ -133,7 +133,7 @@ class Request:
return out
class Response:
class Response(object):
extract_status = re.compile(b'\\((\\d{3}) (.*)\\)')
def __init__(self, httpVersion, status, statusText, headers, content, raw=None, comment=None):
@ -202,7 +202,7 @@ class Response:
"comment": getText(self.comment),
}
class FakeSocket:
class FakeSocket(object):
# Original source:
# https://stackoverflow.com/questions/24728088/python-parse-http-response-string

View File

@ -12,7 +12,7 @@ from lib.core.data import logger
from lib.core.exception import SqlmapFilePathException
from lib.core.exception import SqlmapUndefinedMethod
class Connector:
class Connector(object):
"""
This class defines generic dbms protocol functionalities for plugins.
"""

View File

@ -26,7 +26,7 @@ from lib.core.shell import autoCompletion
from lib.request import inject
from thirdparty.six.moves import input as _input
class Custom:
class Custom(object):
"""
This class defines custom enumeration functionalities for plugins.
"""

View File

@ -51,7 +51,7 @@ from lib.utils.brute import columnExists
from lib.utils.brute import tableExists
from thirdparty import six
class Databases:
class Databases(object):
"""
This class defines databases' enumeration functionalities for plugins.
"""

View File

@ -48,7 +48,7 @@ from lib.utils.pivotdumptable import pivotDumpTable
from thirdparty import six
from thirdparty.six.moves import zip as _zip
class Entries:
class Entries(object):
"""
This class defines entries' enumeration functionalities for plugins.
"""

View File

@ -35,7 +35,7 @@ from lib.core.settings import TAKEOVER_TABLE_PREFIX
from lib.core.settings import UNICODE_ENCODING
from lib.request import inject
class Filesystem:
class Filesystem(object):
"""
This class defines generic OS file system functionalities for plugins.
"""

View File

@ -11,7 +11,7 @@ from lib.core.data import logger
from lib.core.enums import OS
from lib.core.exception import SqlmapUndefinedMethod
class Fingerprint:
class Fingerprint(object):
"""
This class defines generic fingerprint functionalities for plugins.
"""

View File

@ -28,7 +28,7 @@ from lib.core.exception import SqlmapNoneDataException
from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.request import inject
class Miscellaneous:
class Miscellaneous(object):
"""
This class defines miscellaneous functionalities for plugins.
"""

View File

@ -37,7 +37,7 @@ from lib.utils.brute import columnExists
from lib.utils.brute import tableExists
from thirdparty import six
class Search:
class Search(object):
"""
This class defines search functionalities for plugins.
"""

View File

@ -9,7 +9,7 @@ import re
from lib.core.exception import SqlmapUndefinedMethod
class Syntax:
class Syntax(object):
"""
This class defines generic syntax functionalities for plugins.
"""

View File

@ -45,7 +45,7 @@ from lib.utils.hash import storeHashesToFile
from lib.utils.pivotdumptable import pivotDumpTable
from thirdparty.six.moves import zip as _zip
class Users:
class Users(object):
"""
This class defines users' enumeration functionalities for plugins.
"""