mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-07 13:11:29 +00:00
one bug fix in dynamic content engine and some code refactoring
This commit is contained in:
@@ -1239,21 +1239,25 @@ def getConsoleWidth(default=80):
|
||||
return width if width else default
|
||||
|
||||
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)
|
||||
xfile = codecs.open(xmlFile, 'rb', conf.dataEncoding)
|
||||
content = xfile.read()
|
||||
kb.cache.content[xmlFile] = content
|
||||
xfile.close()
|
||||
if conf.parseLock:
|
||||
conf.parseLock.release()
|
||||
stream = StringIO(kb.cache.content[xmlFile])
|
||||
stream = StringIO(readCachedFileContent(xmlFile))
|
||||
parse(stream, handler)
|
||||
stream.close()
|
||||
|
||||
def readCachedFileContent(filename, mode='rb'):
|
||||
if filename not in kb.cache.content:
|
||||
kb.data.cacheLock.acquire()
|
||||
|
||||
if filename not in kb.cache.content:
|
||||
checkFile(filename)
|
||||
xfile = codecs.open(filename, mode, conf.dataEncoding)
|
||||
content = xfile.read()
|
||||
kb.cache.content[filename] = content
|
||||
xfile.close()
|
||||
|
||||
kb.data.cacheLock.release()
|
||||
|
||||
return kb.cache.content[filename]
|
||||
|
||||
def readXmlFile(xmlFile):
|
||||
checkFile(xmlFile)
|
||||
xfile = codecs.open(xmlFile, 'r', conf.dataEncoding)
|
||||
|
||||
@@ -16,6 +16,7 @@ import os
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
import urllib2
|
||||
import urlparse
|
||||
|
||||
@@ -993,7 +994,6 @@ def __setConfAttributes():
|
||||
conf.outputPath = None
|
||||
conf.paramDict = {}
|
||||
conf.parameters = {}
|
||||
conf.parseLock = None
|
||||
conf.path = None
|
||||
conf.port = None
|
||||
conf.redirectHandled = False
|
||||
@@ -1001,7 +1001,6 @@ def __setConfAttributes():
|
||||
conf.scheme = None
|
||||
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")
|
||||
conf.seqMatcher = difflib.SequenceMatcher(None)
|
||||
conf.seqLock = None
|
||||
conf.sessionFP = None
|
||||
conf.start = True
|
||||
conf.threadContinue = True
|
||||
@@ -1027,7 +1026,10 @@ def __setKnowledgeBaseAttributes():
|
||||
kb.cache.regex = {}
|
||||
|
||||
kb.commonOutputs = None
|
||||
|
||||
kb.data = advancedDict()
|
||||
kb.data.cacheLock = threading.Lock()
|
||||
kb.data.seqLock = None
|
||||
|
||||
# Basic back-end DBMS fingerprint
|
||||
kb.dbms = None
|
||||
|
||||
Reference in New Issue
Block a user