mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-10 00:20:37 +03:00
added kb.cache for storing cached results (e.g. kb.cache.regex for storing compiled regular expressions and kb.cache.md5 for storing precalculated MD5 values during '--users --common-prediction' session)
This commit is contained in:
parent
b798222dd7
commit
0450df8a77
|
@ -76,8 +76,6 @@ from lib.core.settings import SQLITE_ALIASES
|
||||||
from lib.core.settings import ACCESS_ALIASES
|
from lib.core.settings import ACCESS_ALIASES
|
||||||
from lib.core.settings import FIREBIRD_ALIASES
|
from lib.core.settings import FIREBIRD_ALIASES
|
||||||
|
|
||||||
__compiledRegularExpressions = {}
|
|
||||||
|
|
||||||
def paramToDict(place, parameters=None):
|
def paramToDict(place, parameters=None):
|
||||||
"""
|
"""
|
||||||
Split the parameters into names and values, check if these parameters
|
Split the parameters into names and values, check if these parameters
|
||||||
|
@ -1305,14 +1303,11 @@ def getCompiledRegex(regex, *args):
|
||||||
Returns compiled regular expression and stores it in cache for further
|
Returns compiled regular expression and stores it in cache for further
|
||||||
usage
|
usage
|
||||||
"""
|
"""
|
||||||
|
if (regex, args) in kb.cache.regex:
|
||||||
global __compiledRegularExpressions
|
return kb.cache.regex[(regex, args)]
|
||||||
|
|
||||||
if (regex, args) in __compiledRegularExpressions:
|
|
||||||
return __compiledRegularExpressions[(regex, args)]
|
|
||||||
else:
|
else:
|
||||||
retVal = re.compile(regex, *args)
|
retVal = re.compile(regex, *args)
|
||||||
__compiledRegularExpressions[(regex, args)] = retVal
|
kb.cache.regex[(regex, args)] = retVal
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def getPartRun():
|
def getPartRun():
|
||||||
|
|
|
@ -928,6 +928,11 @@ def __setKnowledgeBaseAttributes():
|
||||||
|
|
||||||
kb.absFilePaths = set()
|
kb.absFilePaths = set()
|
||||||
kb.bannerFp = advancedDict()
|
kb.bannerFp = advancedDict()
|
||||||
|
|
||||||
|
kb.cache = advancedDict()
|
||||||
|
kb.cache.regex = {}
|
||||||
|
kb.cache.md5 = {}
|
||||||
|
|
||||||
kb.commonOutputs = None
|
kb.commonOutputs = None
|
||||||
kb.data = advancedDict()
|
kb.data = advancedDict()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user