Some memory improvements of @cachedmethod

This commit is contained in:
Miroslav Stampar
2017-11-09 12:24:11 +01:00
parent 58b87e4b6b
commit 9404b63a42
4 changed files with 8 additions and 7 deletions

View File

@@ -2691,6 +2691,7 @@ def enumValueToNameLookup(type_, value_):
return retVal
@cachedmethod
def extractRegexResult(regex, content, flags=0):
"""
Returns 'result' group value from a possible match with regex on a given

View File

@@ -14,11 +14,11 @@ def cachedmethod(f, cache={}):
def _(*args, **kwargs):
try:
key = (f, tuple(args), frozenset(kwargs.items()))
key = hash((f, tuple(args), frozenset(kwargs.items())))
if key not in cache:
cache[key] = f(*args, **kwargs)
except:
key = "".join(str(_) for _ in (f, args, kwargs))
key = hash("".join(str(_) for _ in (f, args, kwargs)))
if key not in cache:
cache[key] = f(*args, **kwargs)

View File

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