From 5291fe35c949da3f1976bade8c77116db7f9f7a3 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 21 Mar 2011 11:29:43 +0000 Subject: [PATCH] proper implementation of --dbs on Oracle (we are using now schema names as a counterpart to dbs in other DBMSes) --- plugins/dbms/oracle/enumeration.py | 6 ------ plugins/generic/enumeration.py | 17 +++++++++++++++-- xml/queries.xml | 7 +++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/plugins/dbms/oracle/enumeration.py b/plugins/dbms/oracle/enumeration.py index 762e6fde3..47648a53b 100644 --- a/plugins/dbms/oracle/enumeration.py +++ b/plugins/dbms/oracle/enumeration.py @@ -166,12 +166,6 @@ class Enumeration(GenericEnumeration): return ( kb.data.cachedUsersRoles, areAdmins ) - def getDbs(self): - warnMsg = "on Oracle it is not possible to enumerate databases" - logger.warn(warnMsg) - - return [] - def searchDb(self): warnMsg = "on Oracle it is not possible to search databases" logger.warn(warnMsg) diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index da08cebdb..b292fe062 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -656,7 +656,16 @@ class Enumeration: warnMsg += "names will be fetched from 'mysql' database" logger.warn(warnMsg) - infoMsg = "fetching database names" + if Backend.getIdentifiedDbms() == DBMS.ORACLE: + warnMsg = "schema names are going to be used on Oracle " + warnMsg += "for enumeration as the counterpart to database " + warnMsg += "names on other DBMSes" + logger.warn(warnMsg) + + infoMsg = "fetching database (schema) names" + else: + infoMsg = "fetching database names" + logger.info(infoMsg) rootQuery = queries[Backend.getIdentifiedDbms()].dbs @@ -685,7 +694,11 @@ class Enumeration: errMsg = "unable to retrieve the number of databases" raise sqlmapNoneDataException, errMsg - indexRange = getRange(count) + if Backend.getIdentifiedDbms() == DBMS.ORACLE: + plusOne = True + else: + plusOne = False + indexRange = getRange(count, plusOne=plusOne) for index in indexRange: if Backend.getIdentifiedDbms() == DBMS.SYBASE: diff --git a/xml/queries.xml b/xml/queries.xml index 1bc08678f..bb48e4335 100644 --- a/xml/queries.xml +++ b/xml/queries.xml @@ -259,8 +259,11 @@ - - + + + + +