Minor bug fix to --dbms, updated user's manual

This commit is contained in:
Bernardo Damele 2009-07-09 11:05:24 +00:00
parent 4b622ed860
commit 24a3a23159
5 changed files with 39 additions and 22 deletions

View File

@ -1571,11 +1571,13 @@ At the moment the fully supported database management system are four:</P>
</UL> </UL>
</P> </P>
<P>It is possible to force the name if you already know it so that sqlmap <P>It is possible to force the DBMS name if you already know it so that sqlmap
will skip the fingerprint with an exception for MySQL to only identify if will skip the fingerprint with an exception for MySQL and Microsoft SQL
it is MySQL &lt; 5.0 or MySQL &gt;= 5.0. Server to only identify the version.
To avoid also this check you can provide instead <CODE>MySQL 4</CODE> or To avoid also this check you can provide instead <CODE>MySQL VERSION</CODE> or
<CODE>MySQL 5</CODE>.</P> <CODE>Microsoft SQL Server VERSION</CODE> where version is a valid version for
the DBMS, for instance <CODE>5.0</CODE> for MySQL and <CODE>2005</CODE> for
Microsoft SQL Server.</P>
<P>Example on a <B>PostgreSQL 8.3.5</B> target:</P> <P>Example on a <B>PostgreSQL 8.3.5</B> target:</P>
<P> <P>
<BLOCKQUOTE><CODE> <BLOCKQUOTE><CODE>

Binary file not shown.

View File

@ -1507,11 +1507,13 @@ At the moment the fully supported database management system are four:
</itemize> </itemize>
<p> <p>
It is possible to force the name if you already know it so that sqlmap It is possible to force the DBMS name if you already know it so that sqlmap
will skip the fingerprint with an exception for MySQL to only identify if will skip the fingerprint with an exception for MySQL and Microsoft SQL
it is MySQL &lt; 5.0 or MySQL &gt;= 5.0. Server to only identify the version.
To avoid also this check you can provide instead <tt>MySQL 4</tt> or To avoid also this check you can provide instead <tt>MySQL VERSION</tt> or
<tt>MySQL 5</tt>. <tt>Microsoft SQL Server VERSION</tt> where version is a valid version for
the DBMS, for instance <tt>5.0</tt> for MySQL and <tt>2005</tt> for
Microsoft SQL Server.
Example on a <bf>PostgreSQL 8.3.5</bf> target: Example on a <bf>PostgreSQL 8.3.5</bf> target:

View File

@ -55,6 +55,8 @@ from lib.core.exception import sqlmapUnsupportedDBMSException
from lib.core.optiondict import optDict from lib.core.optiondict import optDict
from lib.core.settings import MSSQL_ALIASES from lib.core.settings import MSSQL_ALIASES
from lib.core.settings import MYSQL_ALIASES from lib.core.settings import MYSQL_ALIASES
from lib.core.settings import PGSQL_ALIASES
from lib.core.settings import ORACLE_ALIASES
from lib.core.settings import IS_WIN from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM from lib.core.settings import PLATFORM
from lib.core.settings import SITE from lib.core.settings import SITE
@ -461,8 +463,10 @@ def __setDBMS():
logger.debug(debugMsg) logger.debug(debugMsg)
conf.dbms = conf.dbms.lower() conf.dbms = conf.dbms.lower()
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]), firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
"|".join([alias for alias in MYSQL_ALIASES])) "|".join([alias for alias in MYSQL_ALIASES]),
"|".join([alias for alias in PGSQL_ALIASES]),
"|".join([alias for alias in ORACLE_ALIASES]))
dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, conf.dbms) dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, conf.dbms)
if dbmsRegExp: if dbmsRegExp:

View File

@ -34,6 +34,8 @@ from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.settings import MSSQL_ALIASES from lib.core.settings import MSSQL_ALIASES
from lib.core.settings import MYSQL_ALIASES from lib.core.settings import MYSQL_ALIASES
from lib.core.settings import PGSQL_ALIASES
from lib.core.settings import ORACLE_ALIASES
def setString(): def setString():
@ -133,8 +135,10 @@ def setDbms(dbms):
if condition: if condition:
dataToSessionFile("[%s][%s][%s][DBMS][%s]\n" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], dbms)) dataToSessionFile("[%s][%s][%s][DBMS][%s]\n" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], dbms))
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]), firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
"|".join([alias for alias in MYSQL_ALIASES])) "|".join([alias for alias in MYSQL_ALIASES]),
"|".join([alias for alias in PGSQL_ALIASES]),
"|".join([alias for alias in ORACLE_ALIASES]))
dbmsRegExp = re.search("^%s" % firstRegExp, dbms, re.I) dbmsRegExp = re.search("^%s" % firstRegExp, dbms, re.I)
if dbmsRegExp: if dbmsRegExp:
@ -368,20 +372,23 @@ def resumeConfKb(expression, url, value):
logger.info(logMsg) logger.info(logMsg)
elif expression == "DBMS" and url == conf.url: elif expression == "DBMS" and url == conf.url:
dbms = value[:-1] dbms = value[:-1]
dbms = dbms.lower()
dbmsVersion = None
logMsg = "resuming back-end DBMS '%s' " % dbms logMsg = "resuming back-end DBMS '%s' " % dbms
logMsg += "from session file" logMsg += "from session file"
logger.info(logMsg) logger.info(logMsg)
dbms = dbms.lower() firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]), "|".join([alias for alias in MYSQL_ALIASES]),
"|".join([alias for alias in MYSQL_ALIASES])) "|".join([alias for alias in PGSQL_ALIASES]),
"|".join([alias for alias in ORACLE_ALIASES]))
dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, dbms) dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, dbms)
if dbmsRegExp: if dbmsRegExp:
dbms = dbmsRegExp.group(1) dbms = dbmsRegExp.group(1)
kb.dbmsVersion = [ dbmsRegExp.group(2) ] dbmsVersion = [ dbmsRegExp.group(2) ]
if conf.dbms and conf.dbms.lower() != dbms: if conf.dbms and conf.dbms.lower() != dbms:
message = "you provided '%s' as back-end DBMS, " % conf.dbms message = "you provided '%s' as back-end DBMS, " % conf.dbms
@ -392,9 +399,11 @@ def resumeConfKb(expression, url, value):
test = readInput(message, default="N") test = readInput(message, default="N")
if not test or test[0] in ("n", "N"): if not test or test[0] in ("n", "N"):
conf.dbms = dbms conf.dbms = dbms
kb.dbmsVersion = dbmsVersion
else: else:
conf.dbms = dbms conf.dbms = dbms
kb.dbmsVersion = dbmsVersion
elif expression == "OS" and url == conf.url: elif expression == "OS" and url == conf.url:
os = value[:-1] os = value[:-1]