Skip to content

Commit ab9cb80

Browse files
committed
Implementing Issue sqlmapproject#111
1 parent 6809449 commit ab9cb80

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/core/convert.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,4 @@ def htmlunescape(value):
144144
if value and isinstance(value, basestring):
145145
codes = (('&lt;', '<'), ('&gt;', '>'), ('&quot;', '"'), ('&nbsp;', ' '), ('&amp;', '&'))
146146
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal)
147-
retVal = re.sub('&#(\d+);', lambda x: getUnicode(chr(x.group(1))), retVal)
148147
return retVal

lib/request/basic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ def decodePage(page, contentEncoding, contentType):
209209
else:
210210
kb.pageEncoding = conf.charset
211211

212+
# can't do for all responses because we need to support binary files too
212213
if contentType and not isinstance(page, unicode) and any(map(lambda x: x in contentType.lower(), ("text/txt", "text/raw", "text/html", "text/xml"))):
213-
# can't do for all responses because we need to support binary files too
214+
if "&#" in page:
215+
page = re.sub('&#(\d+);', lambda _: chr(int(_.group(1))), page)
214216
kb.pageEncoding = kb.pageEncoding or checkCharEncoding(getHeuristicCharEncoding(page))
215217
page = getUnicode(page, kb.pageEncoding)
216218

0 commit comments

Comments
 (0)