mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
some code refactoring and beautification
This commit is contained in:
parent
13e93f564a
commit
5269cb8c08
|
@ -1245,7 +1245,7 @@ def parseXmlFile(xmlFile, handler):
|
|||
|
||||
def readCachedFileContent(filename, mode='rb'):
|
||||
if filename not in kb.cache.content:
|
||||
kb.data.cacheLock.acquire()
|
||||
kb.locks.cacheLock.acquire()
|
||||
|
||||
if filename not in kb.cache.content:
|
||||
checkFile(filename)
|
||||
|
@ -1254,7 +1254,7 @@ def readCachedFileContent(filename, mode='rb'):
|
|||
kb.cache.content[filename] = content
|
||||
xfile.close()
|
||||
|
||||
kb.data.cacheLock.release()
|
||||
kb.locks.cacheLock.release()
|
||||
|
||||
return kb.cache.content[filename]
|
||||
|
||||
|
|
|
@ -1028,8 +1028,6 @@ def __setKnowledgeBaseAttributes():
|
|||
kb.commonOutputs = None
|
||||
|
||||
kb.data = advancedDict()
|
||||
kb.data.cacheLock = threading.Lock()
|
||||
kb.data.seqLock = None
|
||||
|
||||
# Basic back-end DBMS fingerprint
|
||||
kb.dbms = None
|
||||
|
@ -1053,6 +1051,11 @@ def __setKnowledgeBaseAttributes():
|
|||
kb.keywords = set(getFileItems(paths.SQL_KEYWORDS))
|
||||
kb.lastErrorPage = None
|
||||
kb.lastRequestUID = 0
|
||||
|
||||
kb.locks = advancedDict()
|
||||
kb.locks.cacheLock = threading.Lock()
|
||||
kb.locks.seqLock = None
|
||||
|
||||
kb.nullConnection = None
|
||||
|
||||
# Back-end DBMS underlying operating system fingerprint via banner (-b)
|
||||
|
|
|
@ -58,8 +58,8 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
|||
else:
|
||||
page = re.sub('(?s)%s.+%s' % (prefix, postfix), '%s%s' % (prefix, postfix), page)
|
||||
|
||||
if kb.data.seqLock:
|
||||
kb.data.seqLock.acquire()
|
||||
if kb.locks.seqLock:
|
||||
kb.locks.seqLock.acquire()
|
||||
|
||||
if not conf.eRegexp and not conf.eString and kb.nullConnection:
|
||||
ratio = 1. * pageLength / len(conf.seqMatcher.a)
|
||||
|
@ -69,8 +69,8 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
|
|||
conf.seqMatcher.set_seq2(page if not conf.textOnly else getFilteredPageContent(page))
|
||||
ratio = round(conf.seqMatcher.ratio(), 3)
|
||||
|
||||
if kb.data.seqLock:
|
||||
kb.data.seqLock.release()
|
||||
if kb.locks.seqLock:
|
||||
kb.locks.seqLock.release()
|
||||
|
||||
# If the url is stable and we did not set yet the match ratio and the
|
||||
# current injected value changes the url page content
|
||||
|
|
|
@ -251,7 +251,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
idxlock = threading.Lock()
|
||||
iolock = threading.Lock()
|
||||
valuelock = threading.Lock()
|
||||
kb.data.seqLock = threading.Lock()
|
||||
kb.locks.seqLock = threading.Lock()
|
||||
conf.threadContinue = True
|
||||
|
||||
def downloadThread():
|
||||
|
@ -415,7 +415,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
if conf.verbose >= 1 and not showEta and infoMsg:
|
||||
dataToStdout(infoMsg)
|
||||
|
||||
kb.data.seqLock = None
|
||||
kb.locks.seqLock = None
|
||||
|
||||
# No multi-threading (--threads = 1)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user