From d247fda9d33e71c004433ad42520eaa1ab85a4a9 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 1 Feb 2021 21:34:26 +0100 Subject: [PATCH] Fixing HTTP chunking for Python2.6 --- lib/core/option.py | 10 +++++++++- lib/core/settings.py | 2 +- lib/core/testing.py | 2 +- lib/parse/cmdline.py | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 11a583a97..8ed689ed7 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -2477,7 +2477,15 @@ def _setTorSocksProxySettings(): def _setHttpChunked(): if conf.chunked and conf.data: - _http_client.HTTPConnection._set_content_length = lambda self, *args, **kwargs: None + if hasattr(_http_client.HTTPConnection, "_set_content_length"): + _http_client.HTTPConnection._set_content_length = lambda self, *args, **kwargs: None + else: + def putheader(self, header, *values): + if header != HTTP_HEADER.CONTENT_LENGTH: + self._putheader(header, *values) + + _http_client.HTTPConnection._putheader = _http_client.HTTPConnection.putheader + _http_client.HTTPConnection.putheader = putheader def _checkWebSocket(): if conf.url and (conf.url.startswith("ws:/") or conf.url.startswith("wss:/")): diff --git a/lib/core/settings.py b/lib/core/settings.py index 2035772e8..ebf0a9440 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.5.1.47" +VERSION = "1.5.2.0" 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/core/testing.py b/lib/core/testing.py index edb823a0a..95ce15940 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -134,7 +134,7 @@ def vulnTest(): for tag, value in (("", url), ("", direct), ("", request), ("", log), ("", config), ("", url.replace("id=1", "id=MZ=%3d"))): options = options.replace(tag, value) - cmd = "%s %s %s --batch --non-interactive --debug" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options) + cmd = "%s \"%s\" %s --batch --non-interactive --debug" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options) if "" in cmd: handle, tmp = tempfile.mkstemp() diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 9d5bdc8f5..6992f5dcc 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -1068,7 +1068,7 @@ def cmdLineParser(argv=None): except SystemExit: # Protection against Windows dummy double clicking - if IS_WIN: + if IS_WIN and "--non-interactive" not in sys.argv: dataToStdout("\nPress Enter to continue...") _input() raise