diff --git a/lib/core/common.py b/lib/core/common.py index 4a1992356..0ea17c5a0 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1111,7 +1111,7 @@ def profile(profileOutputFile=None, imageOutputFile=None): logger.info(infoMsg) 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): errMsg = "there was an error while converting ('%s')" % stderr.strip() @@ -1164,27 +1164,28 @@ def parseXmlFile(xmlFile, handler): def calculateDeltaSeconds(start, epsilon=0.05): return int(time.time() - start + epsilon) -def getCommonPredictionTables(value, originalTable): - if not kb.commonTables: - kb.commonTables = {} - fileName = os.path.join(paths.SQLMAP_TXT_PATH, 'common-tables.txt') - file = open(fileName, 'r') - key = None - for line in file.xreadlines(): - line = line.strip() - if len(line) > 1: - if line[0] == '[' and line[-1] == ']': - key = line[1:-1] - elif key: - if key not in kb.commonTables: - kb.commonTables[key] = [] - kb.commonTables[key].append(line.strip()) +def initCommonOutputs(): + kb.commonOutputs = {} + fileName = os.path.join(paths.SQLMAP_TXT_PATH, 'common-outputs.txt') + file = open(fileName, 'r') + key = None + for line in file.xreadlines(): + line = line.strip() + if len(line) > 1: + if line[0] == '[' and line[-1] == ']': + key = line[1:-1] + elif key: + if key not in kb.commonTables: + kb.commonTables[key] = [] + kb.commonTables[key].append(line.strip()) + +def getGoodSamaritanCharsets(part, originalCharset): + if not kb.commonOutputs: + initCommonOutputs() predictionSet = set() wildIndexes = [] - kb.dbms = 'MySQL' - if value[-1] != '.': value += '.' charIndex = 0 diff --git a/lib/core/option.py b/lib/core/option.py index 4d3e7bd84..40397f154 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -928,7 +928,7 @@ def __setKnowledgeBaseAttributes(): kb.absFilePaths = set() kb.bannerFp = advancedDict() kb.data = advancedDict() - kb.commonTables = None + kb.commonOutputs = None # Basic back-end DBMS fingerprint kb.dbms = None