From 0f697418d9513807cc6ce5d3e4c890b3122ba27f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 18 Apr 2019 11:52:33 +0200 Subject: [PATCH] Update regarding #545 --- lib/core/common.py | 6 +++--- lib/core/settings.py | 2 +- lib/request/connect.py | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 3c78c5d65..eb9f95861 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2431,11 +2431,11 @@ def getUnicode(value, encoding=None, noneToNull=False): except UnicodeDecodeError: return six.text_type(str(value), errors="ignore") # encoding ignored for non-basestring instances -def getASCII(value): +def getBytes(value): """ - Returns ASCII representation of provided Unicode value + Returns byte representation of provided Unicode value - >>> getASCII(getUnicode("foo\x01\x83\xffbar")) == "foo\x01\x83\xffbar" + >>> getBytes(getUnicode("foo\x01\x83\xffbar")) == "foo\x01\x83\xffbar" True """ diff --git a/lib/core/settings.py b/lib/core/settings.py index 691f0eb1b..bc4e7c632 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -17,7 +17,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.3.4.23" +VERSION = "1.3.4.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/connect.py b/lib/request/connect.py index bdddfcd58..d74539bed 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -34,6 +34,7 @@ from lib.core.common import evaluateCode from lib.core.common import extractRegexResult from lib.core.common import filterNone from lib.core.common import findMultipartPostBoundary +from lib.core.common import getBytes from lib.core.common import getCurrentThreadData from lib.core.common import getHeader from lib.core.common import getHostHeader @@ -420,8 +421,8 @@ class Connect(object): value = re.sub(r"(%s)([^ \t])" % char, r"\g<1>\t\g<2>", value) headers[unicodeencode(key, kb.pageEncoding)] = value.strip("\r\n") - url = unicodeencode(url) - post = unicodeencode(post) + url = getBytes(url) + post = getBytes(post) if websocket_: ws = websocket.WebSocket() @@ -452,7 +453,7 @@ class Connect(object): logger.log(CUSTOM_LOGGING.TRAFFIC_OUT, requestMsg) else: if method and method not in (HTTPMETHOD.GET, HTTPMETHOD.POST): - method = unicodeencode(method) + method = getBytes(method) req = MethodRequest(url, post, headers) req.set_method(method) elif url is not None: