mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
fix for a bug reported by Ulisses Castro (Too many open files) - also, added an important caching mechanism with thread safe logic
This commit is contained in:
@@ -27,6 +27,9 @@ Velky Brat <velkybrat@gmail.com>
|
|||||||
Jack Butler <fattredd@hotmail.com>
|
Jack Butler <fattredd@hotmail.com>
|
||||||
for providing me with the sqlmap site favicon
|
for providing me with the sqlmap site favicon
|
||||||
|
|
||||||
|
Ulisses Castro <uss.thebug@gmail.com>
|
||||||
|
for reporting a bug
|
||||||
|
|
||||||
Roberto Castrogiovanni <castrogiovanni.roberto@gmail.com>
|
Roberto Castrogiovanni <castrogiovanni.roberto@gmail.com>
|
||||||
for reporting a minor bug
|
for reporting a minor bug
|
||||||
|
|
||||||
|
|||||||
@@ -1239,13 +1239,20 @@ def getConsoleWidth(default=80):
|
|||||||
return width if width else default
|
return width if width else default
|
||||||
|
|
||||||
def parseXmlFile(xmlFile, handler):
|
def parseXmlFile(xmlFile, handler):
|
||||||
|
if xmlFile not in kb.cache.content:
|
||||||
|
if conf.parseLock:
|
||||||
|
conf.parseLock.acquire()
|
||||||
|
if xmlFile not in kb.cache.content:
|
||||||
checkFile(xmlFile)
|
checkFile(xmlFile)
|
||||||
xfile = codecs.open(xmlFile, 'rb', conf.dataEncoding)
|
xfile = codecs.open(xmlFile, 'rb', conf.dataEncoding)
|
||||||
content = xfile.read()
|
content = xfile.read()
|
||||||
stream = StringIO(content)
|
kb.cache.content[xmlFile] = content
|
||||||
|
xfile.close()
|
||||||
|
if conf.parseLock:
|
||||||
|
conf.parseLock.release()
|
||||||
|
stream = StringIO(kb.cache.content[xmlFile])
|
||||||
parse(stream, handler)
|
parse(stream, handler)
|
||||||
stream.close()
|
stream.close()
|
||||||
xfile.close()
|
|
||||||
|
|
||||||
def readXmlFile(xmlFile):
|
def readXmlFile(xmlFile):
|
||||||
checkFile(xmlFile)
|
checkFile(xmlFile)
|
||||||
|
|||||||
@@ -993,6 +993,7 @@ def __setConfAttributes():
|
|||||||
conf.outputPath = None
|
conf.outputPath = None
|
||||||
conf.paramDict = {}
|
conf.paramDict = {}
|
||||||
conf.parameters = {}
|
conf.parameters = {}
|
||||||
|
conf.parseLock = None
|
||||||
conf.path = None
|
conf.path = None
|
||||||
conf.port = None
|
conf.port = None
|
||||||
conf.redirectHandled = False
|
conf.redirectHandled = False
|
||||||
@@ -1022,6 +1023,7 @@ def __setKnowledgeBaseAttributes():
|
|||||||
kb.bannerFp = advancedDict()
|
kb.bannerFp = advancedDict()
|
||||||
|
|
||||||
kb.cache = advancedDict()
|
kb.cache = advancedDict()
|
||||||
|
kb.cache.content = {}
|
||||||
kb.cache.regex = {}
|
kb.cache.regex = {}
|
||||||
|
|
||||||
kb.commonOutputs = None
|
kb.commonOutputs = None
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||||||
iolock = threading.Lock()
|
iolock = threading.Lock()
|
||||||
valuelock = threading.Lock()
|
valuelock = threading.Lock()
|
||||||
conf.seqLock = threading.Lock()
|
conf.seqLock = threading.Lock()
|
||||||
|
conf.parseLock = threading.Lock()
|
||||||
conf.threadContinue = True
|
conf.threadContinue = True
|
||||||
|
|
||||||
def downloadThread():
|
def downloadThread():
|
||||||
@@ -416,6 +417,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||||||
dataToStdout(infoMsg)
|
dataToStdout(infoMsg)
|
||||||
|
|
||||||
conf.seqLock = None
|
conf.seqLock = None
|
||||||
|
conf.parseLock = None
|
||||||
|
|
||||||
# No multi-threading (--threads = 1)
|
# No multi-threading (--threads = 1)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user