Minor improvements

This commit is contained in:
Miroslav Stampar
2025-12-28 01:33:15 +01:00
parent 673a7a5ff8
commit c95f67c7e2
4 changed files with 21 additions and 12 deletions

View File

@@ -5017,6 +5017,10 @@ def extractExpectedValue(value, expected):
>>> extractExpectedValue(['1'], EXPECTED.BOOL)
True
>>> extractExpectedValue(['17'], EXPECTED.BOOL)
True
>>> extractExpectedValue(['0'], EXPECTED.BOOL)
False
>>> extractExpectedValue('1', EXPECTED.INT)
1
>>> extractExpectedValue('7\\xb9645', EXPECTED.INT) is None
@@ -5037,10 +5041,10 @@ def extractExpectedValue(value, expected):
value = value == "true"
elif value in ('t', 'f'):
value = value == 't'
elif value in ("1", "-1"):
value = True
elif value == '0':
value = False
elif re.search(r"\A-?[1-9]\d*\Z", value):
value = True
else:
value = None
elif expected == EXPECTED.INT:

View File

@@ -49,16 +49,21 @@ def cachedmethod(f):
)
try:
key = struct.unpack(">Q", hashlib.md5("`".join(parts).encode(UNICODE_ENCODING)).digest()[:8])[0] & 0x7fffffffffffffff
except ValueError: # https://github.com/sqlmapproject/sqlmap/issues/4281 (NOTE: non-standard Python behavior where hexdigest returns binary value)
except (struct.error, ValueError): # https://github.com/sqlmapproject/sqlmap/issues/4281 (NOTE: non-standard Python behavior where hexdigest returns binary value)
result = f(*args, **kwargs)
else:
lock, cache = _method_locks[f], _cache[f]
with lock:
try:
result = cache[key]
except KeyError:
result = f(*args, **kwargs)
cache[key] = result
if key in cache:
return cache[key]
result = f(*args, **kwargs)
with lock:
cache[key] = result
return result
return result

View File

@@ -19,7 +19,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.9.12.23"
VERSION = "1.9.12.24"
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)