From 0b715f7b0eabb0722a7584e1a46214100d51dc2a Mon Sep 17 00:00:00 2001 From: Tomas Zellerin Date: Wed, 15 Jan 2020 14:45:47 +0100 Subject: [PATCH] Fix python3 binary - character mismatch in api.py Convert between text and binary data in api.py call to urllib.request and response from it. In python3 sqlmapapi -c it fixes, at least - not nice output from log/list commands - any command that POSTs data (including new) crashing sqlmapapi --- lib/utils/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils/api.py b/lib/utils/api.py index 19593fc94..480193148 100644 --- a/lib/utils/api.py +++ b/lib/utils/api.py @@ -713,7 +713,7 @@ def _client(url, options=None): try: data = None if options is not None: - data = jsonize(options) + data = jsonize(options).encode("utf-8") headers = {"Content-Type": "application/json"} if DataStore.username or DataStore.password: @@ -721,7 +721,7 @@ def _client(url, options=None): req = _urllib.request.Request(url, data, headers) response = _urllib.request.urlopen(req) - text = response.read() + text = response.read().decode("utf-8") except: if options: logger.error("Failed to load and parse %s" % url)