From da86486cd9e759ba404977fdfee1d5a6ef1a4a07 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 24 May 2021 13:12:18 +0200 Subject: [PATCH] Couple of minor patches --- lib/core/settings.py | 2 +- thirdparty/ansistrm/ansistrm.py | 2 -- thirdparty/beautifulsoup/beautifulsoup.py | 2 -- thirdparty/fcrypt/fcrypt.py | 2 +- thirdparty/keepalive/keepalive.py | 8 ++++---- thirdparty/magic/magic.py | 3 +-- thirdparty/multipart/multipartpost.py | 1 - thirdparty/six/__init__.py | 12 +++++++++++- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index d2ae62c1d..d41bbf999 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.5.5.6" +VERSION = "1.5.5.7" 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) diff --git a/thirdparty/ansistrm/ansistrm.py b/thirdparty/ansistrm/ansistrm.py index 9b45c4e12..a623dad8b 100644 --- a/thirdparty/ansistrm/ansistrm.py +++ b/thirdparty/ansistrm/ansistrm.py @@ -4,8 +4,6 @@ # import logging -import os -import re import sys from lib.core.settings import IS_WIN diff --git a/thirdparty/beautifulsoup/beautifulsoup.py b/thirdparty/beautifulsoup/beautifulsoup.py index bc8889f76..60ff0475f 100644 --- a/thirdparty/beautifulsoup/beautifulsoup.py +++ b/thirdparty/beautifulsoup/beautifulsoup.py @@ -85,7 +85,6 @@ __copyright__ = "Copyright (c) 2004-2012 Leonard Richardson" __license__ = "New-style BSD" import codecs -import types import re import sys @@ -2029,6 +2028,5 @@ class UnicodeDammit: #By default, act as an HTML pretty-printer. if __name__ == '__main__': - import sys soup = BeautifulSoup(sys.stdin) print(soup.prettify()) diff --git a/thirdparty/fcrypt/fcrypt.py b/thirdparty/fcrypt/fcrypt.py index 2f664d81a..8fb36a623 100644 --- a/thirdparty/fcrypt/fcrypt.py +++ b/thirdparty/fcrypt/fcrypt.py @@ -119,7 +119,7 @@ __all__ = ['crypt'] # ----- END fcrypt.c LICENSE ----- -import string, struct, sys +import struct, sys if sys.version_info >= (3, 0): xrange = range diff --git a/thirdparty/keepalive/keepalive.py b/thirdparty/keepalive/keepalive.py index 59cd9aacc..2dda424e6 100644 --- a/thirdparty/keepalive/keepalive.py +++ b/thirdparty/keepalive/keepalive.py @@ -517,7 +517,7 @@ def error_handler(url): keepalive_handler.close_all() def continuity(url): - import md5 + from hashlib import md5 format = '%25s: %s' # first fetch the file with the normal http handler @@ -526,7 +526,7 @@ def continuity(url): fo = _urllib.request.urlopen(url) foo = fo.read() fo.close() - m = md5.new(foo) + m = md5(foo) print(format % ('normal urllib', m.hexdigest())) # now install the keepalive handler and try again @@ -536,7 +536,7 @@ def continuity(url): fo = _urllib.request.urlopen(url) foo = fo.read() fo.close() - m = md5.new(foo) + m = md5(foo) print(format % ('keepalive read', m.hexdigest())) fo = _urllib.request.urlopen(url) @@ -546,7 +546,7 @@ def continuity(url): if f: foo = foo + f else: break fo.close() - m = md5.new(foo) + m = md5(foo) print(format % ('keepalive readline', m.hexdigest())) def comp(N, url): diff --git a/thirdparty/magic/magic.py b/thirdparty/magic/magic.py index c99c17041..0a5c2575a 100644 --- a/thirdparty/magic/magic.py +++ b/thirdparty/magic/magic.py @@ -117,7 +117,6 @@ try: pass if not libmagic or not libmagic._name: - import sys platform_to_lib = {'darwin': ['/opt/local/lib/libmagic.dylib', '/usr/local/lib/libmagic.dylib', '/usr/local/Cellar/libmagic/5.10/lib/libmagic.dylib'], @@ -223,4 +222,4 @@ MAGIC_NO_CHECK_ASCII = 0x020000 # Don't check for ascii files MAGIC_NO_CHECK_TROFF = 0x040000 # Don't check ascii/troff MAGIC_NO_CHECK_FORTRAN = 0x080000 # Don't check ascii/fortran MAGIC_NO_CHECK_TOKENS = 0x100000 # Don't check ascii/tokens -MAGIC_UNKNOWN_FILETYPE = b"unknown" \ No newline at end of file +MAGIC_UNKNOWN_FILETYPE = b"unknown" diff --git a/thirdparty/multipart/multipartpost.py b/thirdparty/multipart/multipartpost.py index ff0da31f1..5ea37ccf7 100644 --- a/thirdparty/multipart/multipartpost.py +++ b/thirdparty/multipart/multipartpost.py @@ -29,7 +29,6 @@ import sys from lib.core.compat import choose_boundary from lib.core.convert import getBytes -from lib.core.convert import getText from lib.core.exception import SqlmapDataException from thirdparty.six.moves import urllib as _urllib diff --git a/thirdparty/six/__init__.py b/thirdparty/six/__init__.py index d162d09cd..4e15675d8 100644 --- a/thirdparty/six/__init__.py +++ b/thirdparty/six/__init__.py @@ -29,7 +29,7 @@ import sys import types __author__ = "Benjamin Peterson " -__version__ = "1.15.0" +__version__ = "1.16.0" # Useful for very coarse version differentiation. @@ -71,6 +71,11 @@ else: MAXSIZE = int((1 << 63) - 1) del X +if PY34: + from importlib.util import spec_from_loader +else: + spec_from_loader = None + def _add_doc(func, doc): """Add documentation to a function.""" @@ -186,6 +191,11 @@ class _SixMetaPathImporter(object): return self return None + def find_spec(self, fullname, path, target=None): + if fullname in self.known_modules: + return spec_from_loader(fullname, self) + return None + def __get_module(self, fullname): try: return self.known_modules[fullname]