From 342a5436f4f881e2f74fece01c9a2d23d4bb502f Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Sun, 26 Oct 2008 17:07:55 +0000 Subject: [PATCH] Minor enhancement to be able to dump entries also on MySQL < 5.0 when DB name, table name and column(s) are provided --- plugins/generic/enumeration.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 02a43019f..823f0676e 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -784,11 +784,6 @@ class Enumeration: def dumpTable(self): - if kb.dbms == "MySQL" and not self.has_information_schema: - errMsg = "information_schema not available, " - errMsg += "back-end DBMS is MySQL < 5.0" - raise sqlmapUnsupportedFeatureException, errMsg - if not conf.tbl: errMsg = "missing table parameter" raise sqlmapMissingMandatoryOptionException, errMsg @@ -804,6 +799,23 @@ class Enumeration: rootQuery = queries[kb.dbms].dumpTable + if conf.col: + self.cachedColumns[conf.db] = {} + self.cachedColumns[conf.db][conf.tbl] = {} + for column in colList: + self.cachedColumns[conf.db][conf.tbl][column] = None + elif not self.cachedColumns: + if kb.dbms == "MySQL" and not self.has_information_schema: + errMsg = "information_schema not available, " + errMsg += "back-end DBMS is MySQL < 5.0" + raise sqlmapUnsupportedFeatureException, errMsg + + self.cachedColumns = self.getColumns(onlyColNames=True) + + colList = self.cachedColumns[conf.db][conf.tbl].keys() + colList.sort(key=lambda x: x.lower()) + colString = ", ".join(column for column in colList) + logMsg = "fetching" if conf.col: colList = conf.col.split(",") @@ -813,18 +825,6 @@ class Enumeration: logMsg += " on database '%s'" % conf.db logger.info(logMsg) - if conf.col: - self.cachedColumns[conf.db] = {} - self.cachedColumns[conf.db][conf.tbl] = {} - for column in colList: - self.cachedColumns[conf.db][conf.tbl][column] = None - elif not self.cachedColumns: - self.cachedColumns = self.getColumns(onlyColNames=True) - - colList = self.cachedColumns[conf.db][conf.tbl].keys() - colList.sort(key=lambda x: x.lower()) - colString = ", ".join(column for column in colList) - if conf.unionUse: if kb.dbms == "Oracle": query = rootQuery["inband"]["query"] % (colString, conf.tbl.upper())