mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-29 17:39:56 +03:00
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
This commit is contained in:
parent
c082067902
commit
0b715f7b0e
|
@ -713,7 +713,7 @@ def _client(url, options=None):
|
||||||
try:
|
try:
|
||||||
data = None
|
data = None
|
||||||
if options is not None:
|
if options is not None:
|
||||||
data = jsonize(options)
|
data = jsonize(options).encode("utf-8")
|
||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
if DataStore.username or DataStore.password:
|
if DataStore.username or DataStore.password:
|
||||||
|
@ -721,7 +721,7 @@ def _client(url, options=None):
|
||||||
|
|
||||||
req = _urllib.request.Request(url, data, headers)
|
req = _urllib.request.Request(url, data, headers)
|
||||||
response = _urllib.request.urlopen(req)
|
response = _urllib.request.urlopen(req)
|
||||||
text = response.read()
|
text = response.read().decode("utf-8")
|
||||||
except:
|
except:
|
||||||
if options:
|
if options:
|
||||||
logger.error("Failed to load and parse %s" % url)
|
logger.error("Failed to load and parse %s" % url)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user