mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-20 18:54:02 +00:00
Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
This commit is contained in:
parent
4489b2c0d2
commit
026e5d05f4
1 changed files with 7 additions and 1 deletions
|
|
@ -412,6 +412,8 @@ def stdoutEncode(value):
|
||||||
Returns textual representation of a given value safe for writing to stdout
|
Returns textual representation of a given value safe for writing to stdout
|
||||||
>>> stdoutEncode(b"foobar")
|
>>> stdoutEncode(b"foobar")
|
||||||
'foobar'
|
'foobar'
|
||||||
|
>>> stdoutEncode({"url": "http://example.com/foo", "data": "id=1"}) == {"url": "http://example.com/foo", "data": "id=1"}
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if value is None:
|
if value is None:
|
||||||
|
|
@ -437,7 +439,11 @@ def stdoutEncode(value):
|
||||||
if isinstance(value, (bytes, bytearray)):
|
if isinstance(value, (bytes, bytearray)):
|
||||||
value = getUnicode(value, encoding)
|
value = getUnicode(value, encoding)
|
||||||
elif not isinstance(value, str):
|
elif not isinstance(value, str):
|
||||||
value = str(value)
|
# Non-string values (e.g. dicts passed through the REST API path,
|
||||||
|
# where the overridden sys.stdout.write JSON-encodes the value)
|
||||||
|
# must be returned unchanged — stringifying them via str() yields
|
||||||
|
# Python repr() output that the API consumer cannot parse.
|
||||||
|
return value
|
||||||
|
|
||||||
try:
|
try:
|
||||||
retVal = value.encode(encoding, errors="replace").decode(encoding, errors="replace")
|
retVal = value.encode(encoding, errors="replace").decode(encoding, errors="replace")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue