From a851dc486a53f98740125e78a8de7903add6a8db Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 15 May 2020 12:58:03 +0200 Subject: [PATCH] Couple of trivialities --- lib/core/common.py | 10 +++++----- lib/core/settings.py | 2 +- lib/request/redirecthandler.py | 2 ++ sqlmap.py | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 6f25c3a13..f178a7342 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1274,7 +1274,7 @@ def checkPipedInput(): # Reference: https://stackoverflow.com/a/33873570 """ - return not os.isatty(sys.stdin.fileno()) if hasattr(sys.stdin, "fileno") else False + return hasattr(sys.stdin, "fileno") and not os.isatty(sys.stdin.fileno()) def isZipFile(filename): """ @@ -1364,9 +1364,9 @@ def parsePasswordHash(password): >>> kb.forcedDbms = popValue() """ - blank = " " * 8 + blank = ' ' * 8 - if isNoneValue(password) or password == " ": + if isNoneValue(password) or password == ' ': retVal = NULL else: retVal = password @@ -1510,7 +1510,7 @@ def parseTargetDirect(): if details: conf.dbms = details.group("dbms") - if details.group('credentials'): + if details.group("credentials"): conf.dbmsUser = details.group("user") conf.dbmsPass = details.group("pass") else: @@ -1622,7 +1622,7 @@ def parseTargetUrl(): originalUrl = conf.url - if re.search(r"\[.+\]", conf.url) and not socket.has_ipv6: + if re.search(r"://\[.+\]", conf.url) and not socket.has_ipv6: errMsg = "IPv6 communication is not supported " errMsg += "on this platform" raise SqlmapGenericException(errMsg) diff --git a/lib/core/settings.py b/lib/core/settings.py index e7184d296..e0a545370 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.5.23" +VERSION = "1.4.5.24" 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/lib/request/redirecthandler.py b/lib/request/redirecthandler.py index 5ecc2a193..b9016fc01 100644 --- a/lib/request/redirecthandler.py +++ b/lib/request/redirecthandler.py @@ -154,6 +154,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler): except AttributeError: def _(self): return getattr(self, "hdrs") or {} + result.info = types.MethodType(_, result) if not hasattr(result, "read"): @@ -164,6 +165,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler): retVal = "" finally: return retVal + result.read = types.MethodType(_, result) if not getattr(result, "url", None): diff --git a/sqlmap.py b/sqlmap.py index bab9ff774..caee7d577 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -534,4 +534,4 @@ if __name__ == "__main__": sys.exit(getattr(os, "_exitcode", 0)) else: # cancelling postponed imports (because of Travis CI checks) - from lib.controller.controller import start + __import__("lib.controller.controller")