This commit is contained in:
Miroslav Stampar 2019-02-09 23:18:08 +01:00
parent 6f750f9529
commit 4d87b0ff67
4 changed files with 18 additions and 16 deletions

View File

@ -120,15 +120,12 @@ class LRUDict(object):
return key in self.cache return key in self.cache
def __getitem__(self, key): def __getitem__(self, key):
try:
value = self.cache.pop(key) value = self.cache.pop(key)
self.cache[key] = value self.cache[key] = value
return value return value
except KeyError:
return -1
def get(self, key): def get(self, key):
return self.__getitem__(self, key) return self.__getitem__(key)
def __setitem__(self, key, value): def __setitem__(self, key, value):
try: try:

View File

@ -24,12 +24,17 @@ def cachedmethod(f, cache=LRUDict(capacity=MAX_CACHE_ITEMS)):
@functools.wraps(f) @functools.wraps(f)
def _(*args, **kwargs): def _(*args, **kwargs):
with _lock:
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs))).hexdigest(), 16) & 0x7fffffffffffffff key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs))).hexdigest(), 16) & 0x7fffffffffffffff
if key not in cache:
cache[key] = f(*args, **kwargs)
return cache[key] try:
result = cache[key]
except KeyError:
result = f(*args, **kwargs)
with _lock:
cache[key] = result
return result
return _ return _

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.2.14" VERSION = "1.3.2.15"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -33,8 +33,8 @@ a932126e7d80e545c5d44af178d0bc0c lib/core/bigarray.py
964885db1ac028fa622ee5ba20f061b1 lib/core/common.py 964885db1ac028fa622ee5ba20f061b1 lib/core/common.py
de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py de8d27ae6241163ff9e97aa9e7c51a18 lib/core/convert.py
abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py abcb1121eb56d3401839d14e8ed06b6e lib/core/data.py
e1f7758f433202c50426efde5eb96768 lib/core/datatype.py 00828c4455321b6987e3f882f4ef4f92 lib/core/datatype.py
1646402a733e564f05025e848b323cf9 lib/core/decorators.py 3ec93893ad8b1e060540753b7f8a8caf lib/core/decorators.py
5f4680b769ae07f22157bd832c97cf8f lib/core/defaults.py 5f4680b769ae07f22157bd832c97cf8f lib/core/defaults.py
9dfc69ba47209a4ceca494dde9ee8183 lib/core/dicts.py 9dfc69ba47209a4ceca494dde9ee8183 lib/core/dicts.py
4ba141124699fd7a763dea82f17fe523 lib/core/dump.py 4ba141124699fd7a763dea82f17fe523 lib/core/dump.py
@ -50,7 +50,7 @@ d5ef43fe3cdd6c2602d7db45651f9ceb lib/core/readlineng.py
7d8a22c582ad201f65b73225e4456170 lib/core/replication.py 7d8a22c582ad201f65b73225e4456170 lib/core/replication.py
3179d34f371e0295dd4604568fb30bcd lib/core/revision.py 3179d34f371e0295dd4604568fb30bcd lib/core/revision.py
d6269c55789f78cf707e09a0f5b45443 lib/core/session.py d6269c55789f78cf707e09a0f5b45443 lib/core/session.py
8aa51078439218dacde3c4283ed22845 lib/core/settings.py 75098335768c0cfa062995a83ceaef78 lib/core/settings.py
4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py 4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py
10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py 10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py
43772ea73e9e3d446f782af591cb4eda lib/core/target.py 43772ea73e9e3d446f782af591cb4eda lib/core/target.py