Skip to content

Commit 9240e05

Browse files
committed
Patch for -g (DREI)
1 parent 86ce1c5 commit 9240e05

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty import six
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.33"
21+
VERSION = "1.3.5.34"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/basic.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from lib.core.common import filterNone
2020
from lib.core.common import getPublicTypeMembers
2121
from lib.core.common import getSafeExString
22+
from lib.core.common import getText
2223
from lib.core.common import isListLike
2324
from lib.core.common import randomStr
2425
from lib.core.common import readInput
@@ -322,14 +323,14 @@ def decodePage(page, contentEncoding, contentType):
322323
# e.g. &#x9;&#195;&#235;&#224;&#226;&#224;
323324
if b"&#" in page:
324325
page = re.sub(b"&#x([0-9a-f]{1,2});", lambda _: decodeHex(_.group(1) if len(_.group(1)) == 2 else "0%s" % _.group(1)), page)
325-
page = re.sub(b"&#(\d{1,3});", lambda _: chr(int(_.group(1))) if int(_.group(1)) < 256 else _.group(0), page)
326+
page = re.sub(b"&#(\d{1,3});", lambda _: six.int2byte(int(_.group(1))) if int(_.group(1)) < 256 else _.group(0), page)
326327

327328
# e.g. %20%28%29
328329
if b"%" in page:
329330
page = re.sub(b"%([0-9a-fA-F]{2})", lambda _: decodeHex(_.group(1)), page)
330331

331332
# e.g. &amp;
332-
page = re.sub(b"&([^;]+);", lambda _: chr(htmlEntities[_.group(1)]) if htmlEntities.get(_.group(1), 256) < 256 else _.group(0), page)
333+
page = re.sub(b"&([^;]+);", lambda _: six.int2byte(htmlEntities[getText(_.group(1))]) if htmlEntities.get(getText(_.group(1)), 256) < 256 else _.group(0), page)
333334

334335
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
335336

lib/request/redirecthandler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def _get_header_redirect(self, headers):
3737
retVal = None
3838

3939
if headers:
40-
if "location" in headers:
41-
retVal = headers.getheaders("location")[0]
42-
elif "uri" in headers:
43-
retVal = headers.getheaders("uri")[0]
40+
if HTTP_HEADER.LOCATION in headers:
41+
retVal = headers[HTTP_HEADER.LOCATION]
42+
elif HTTP_HEADER.URI in headers:
43+
retVal = headers[HTTP_HEADER.URI]
4444

4545
return retVal
4646

@@ -126,7 +126,7 @@ def http_error_302(self, req, fp, code, msg, headers):
126126
delimiter = conf.cookieDel or DEFAULT_COOKIE_DELIMITER
127127
last = None
128128

129-
for part in req.headers.get(HTTP_HEADER.COOKIE, "").split(delimiter) + headers.getheaders(HTTP_HEADER.SET_COOKIE):
129+
for part in req.headers.get(HTTP_HEADER.COOKIE, "").split(delimiter) + ([headers[HTTP_HEADER.SET_COOKIE]] if HTTP_HEADER.SET_COOKIE in headers else []):
130130
if '=' in part:
131131
part = part.strip()
132132
key, value = part.split('=', 1)

0 commit comments

Comments
 (0)