diff --git a/lib/core/decorators.py b/lib/core/decorators.py index 8ddf00c63..85417b757 100644 --- a/lib/core/decorators.py +++ b/lib/core/decorators.py @@ -39,16 +39,19 @@ def cachedmethod(f): @functools.wraps(f) def _f(*args, **kwargs): - key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs)).encode(UNICODE_ENCODING)).hexdigest(), 16) & 0x7fffffffffffffff - try: - with _cache_lock: - result = _cache[f][key] - except KeyError: + key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs)).encode(UNICODE_ENCODING)).hexdigest(), 16) & 0x7fffffffffffffff + except ValueError: # https://github.com/sqlmapproject/sqlmap/issues/4281 (NOTE: non-standard Python behavior where hexdigest returns binary value) result = f(*args, **kwargs) + else: + try: + with _cache_lock: + result = _cache[f][key] + except KeyError: + result = f(*args, **kwargs) - with _cache_lock: - _cache[f][key] = result + with _cache_lock: + _cache[f][key] = result return result diff --git a/lib/core/settings.py b/lib/core/settings.py index 3f2e1d58b..4b10492e6 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.4.7.17" +VERSION = "1.4.7.18" 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)