mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-13 01:59:01 +00:00
Fixing thread-safety in getHeuristicCharEncoding
This commit is contained in:
@@ -170,7 +170,7 @@ class LRUDict(object):
|
||||
except KeyError:
|
||||
if len(self.cache) >= self.capacity:
|
||||
self.cache.popitem(last=False)
|
||||
self.cache[key] = value
|
||||
self.cache[key] = value
|
||||
|
||||
def set(self, key, value):
|
||||
self.__setitem__(key, value)
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import OS
|
||||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.1.14"
|
||||
VERSION = "1.10.1.15"
|
||||
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)
|
||||
|
||||
@@ -259,8 +259,11 @@ def getHeuristicCharEncoding(page):
|
||||
"""
|
||||
|
||||
key = (len(page), hash(page))
|
||||
retVal = kb.cache.encoding[key] if key in kb.cache.encoding else detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"]
|
||||
kb.cache.encoding[key] = retVal
|
||||
|
||||
retVal = kb.cache.encoding.get(key)
|
||||
if retVal is None:
|
||||
retVal = detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"]
|
||||
kb.cache.encoding[key] = retVal
|
||||
|
||||
if retVal and retVal.lower().replace('-', "") == UNICODE_ENCODING.lower().replace('-', ""):
|
||||
infoMsg = "heuristics detected web page charset '%s'" % retVal
|
||||
|
||||
Reference in New Issue
Block a user