diff --git a/lib/core/settings.py b/lib/core/settings.py index 85d372a5b..b48ba9fc5 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.3.12.24" +VERSION = "1.3.12.25" 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) diff --git a/lib/request/redirecthandler.py b/lib/request/redirecthandler.py index b74665108..13c3fb4a1 100644 --- a/lib/request/redirecthandler.py +++ b/lib/request/redirecthandler.py @@ -10,6 +10,7 @@ import time import types from lib.core.common import getHostHeader +from lib.core.common import getSafeExString from lib.core.common import logHTTPTraffic from lib.core.common import readInput from lib.core.convert import getUnicode @@ -139,6 +140,14 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler): except _urllib.error.HTTPError as ex: result = ex + # Dirty hack for https://github.com/sqlmapproject/sqlmap/issues/4046 + try: + hasattr(result, "read") + except KeyError: + class _(object): + pass + result = _() + # Dirty hack for http://bugs.python.org/issue15701 try: result.info() @@ -149,7 +158,12 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler): if not hasattr(result, "read"): def _(self, length=None): - return ex.msg + try: + retVal = getSafeExString(ex) + except: + retVal = "" + finally: + return retVal result.read = types.MethodType(_, result) if not getattr(result, "url", None):