Minor patch

This commit is contained in:
Miroslav Štampar
2026-07-19 13:17:07 +02:00
parent dcecf55780
commit d08e992ad6
3 changed files with 30 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.125"
VERSION = "1.10.7.126"
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)
+12 -6
View File
@@ -181,16 +181,22 @@ class Response(object):
def toDict(self):
content = {
"mimeType": self.headers.get("Content-Type"),
"text": self.content,
"size": len(self.content or "")
}
binary = set([b'\0', b'\1', u'\0', u'\1', 0, 1])
if any(c in binary for c in self.content):
content["encoding"] = "base64"
content["text"] = getText(base64.b64encode(self.content))
# HAR text must be UTF-8: a body that does not decode (binary content such as an image, or
# text in another charset) is base64-encoded losslessly rather than mangled through a lossy
# text decode. The previous check only treated NUL/0x01 as binary, so e.g. a JPEG lacking
# those bytes was corrupted into the "text" field.
raw = self.content or b""
if not isinstance(raw, bytes):
content["text"] = getText(raw)
else:
content["text"] = getText(content["text"])
try:
content["text"] = getText(raw.decode("utf-8"))
except UnicodeDecodeError:
content["encoding"] = "base64"
content["text"] = getText(base64.b64encode(raw))
return {
"httpVersion": self.httpVersion,