Minor update

This commit is contained in:
Miroslav Štampar 2026-06-21 22:55:45 +02:00
parent 7e652ed15d
commit a3b857ebae
5 changed files with 17 additions and 13 deletions

View file

@ -2532,19 +2532,23 @@ def readCachedFileContent(filename, mode='r'):
True
"""
if filename not in kb.cache.content:
content = kb.cache.content.get(filename)
if content is None:
with kb.locks.cache:
if filename not in kb.cache.content:
content = kb.cache.content.get(filename)
if content is None:
checkFile(filename)
try:
with openFile(filename, mode) as f:
kb.cache.content[filename] = f.read()
content = f.read()
kb.cache.content[filename] = content
except (IOError, OSError, MemoryError) as ex:
errMsg = "something went wrong while trying "
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
raise SqlmapSystemException(errMsg)
return kb.cache.content[filename]
return content
def average(values):
"""

View file

@ -151,7 +151,7 @@ class LRUDict(object):
def get(self, key, default=None):
try:
return self.__getitem__(key)
except:
except (KeyError, TypeError):
return default
def __setitem__(self, key, value):

View file

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

View file

@ -213,9 +213,9 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
seqMatcher.set_seq1(repr(seq1))
seqMatcher.set_seq2(repr(seq2))
if key in kb.cache.comparison:
ratio = kb.cache.comparison[key]
else:
ratio = kb.cache.comparison.get(key) if key else None
if ratio is None:
try:
try:
ratio = seqMatcher.quick_ratio() if not kb.heavilyDynamic else seqMatcher.ratio()