quick fix

This commit is contained in:
Miroslav Stampar 2010-05-21 12:19:20 +00:00
parent cda8da288c
commit 78547bb79e
2 changed files with 20 additions and 19 deletions

View File

@ -1111,7 +1111,7 @@ def profile(profileOutputFile=None, imageOutputFile=None):
logger.info(infoMsg) logger.info(infoMsg)
graphScriptPath = os.path.join(paths.SQLMAP_EXTRAS_PATH, 'gprof2dot', 'gprof2dot.py') graphScriptPath = os.path.join(paths.SQLMAP_EXTRAS_PATH, 'gprof2dot', 'gprof2dot.py')
stderr = subprocess.Popen('python %s -f pstats %s | dot -Tpng -o %s' % (graphScriptPath, profileOutputFile, imageOutputFile), shell=True, stderr=subprocess.PIPE).stderr.read() stderr = subprocess.Popen('%s %s -f pstats %s | dot -Tpng -o %s' % (sys.executable, graphScriptPath, profileOutputFile, imageOutputFile), shell=True, stderr=subprocess.PIPE).stderr.read()
if stderr or not os.path.exists(imageOutputFile): if stderr or not os.path.exists(imageOutputFile):
errMsg = "there was an error while converting ('%s')" % stderr.strip() errMsg = "there was an error while converting ('%s')" % stderr.strip()
@ -1164,27 +1164,28 @@ def parseXmlFile(xmlFile, handler):
def calculateDeltaSeconds(start, epsilon=0.05): def calculateDeltaSeconds(start, epsilon=0.05):
return int(time.time() - start + epsilon) return int(time.time() - start + epsilon)
def getCommonPredictionTables(value, originalTable): def initCommonOutputs():
if not kb.commonTables: kb.commonOutputs = {}
kb.commonTables = {} fileName = os.path.join(paths.SQLMAP_TXT_PATH, 'common-outputs.txt')
fileName = os.path.join(paths.SQLMAP_TXT_PATH, 'common-tables.txt') file = open(fileName, 'r')
file = open(fileName, 'r') key = None
key = None for line in file.xreadlines():
for line in file.xreadlines(): line = line.strip()
line = line.strip() if len(line) > 1:
if len(line) > 1: if line[0] == '[' and line[-1] == ']':
if line[0] == '[' and line[-1] == ']': key = line[1:-1]
key = line[1:-1] elif key:
elif key: if key not in kb.commonTables:
if key not in kb.commonTables: kb.commonTables[key] = []
kb.commonTables[key] = [] kb.commonTables[key].append(line.strip())
kb.commonTables[key].append(line.strip())
def getGoodSamaritanCharsets(part, originalCharset):
if not kb.commonOutputs:
initCommonOutputs()
predictionSet = set() predictionSet = set()
wildIndexes = [] wildIndexes = []
kb.dbms = 'MySQL'
if value[-1] != '.': if value[-1] != '.':
value += '.' value += '.'
charIndex = 0 charIndex = 0

View File

@ -928,7 +928,7 @@ def __setKnowledgeBaseAttributes():
kb.absFilePaths = set() kb.absFilePaths = set()
kb.bannerFp = advancedDict() kb.bannerFp = advancedDict()
kb.data = advancedDict() kb.data = advancedDict()
kb.commonTables = None kb.commonOutputs = None
# Basic back-end DBMS fingerprint # Basic back-end DBMS fingerprint
kb.dbms = None kb.dbms = None