Skip to content

Commit 24a3a23

Browse files
committed
Minor bug fix to --dbms, updated user's manual
1 parent 4b622ed commit 24a3a23

File tree

5 files changed

+39
-22
lines changed

5 files changed

+39
-22
lines changed

doc/README.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,11 +1571,13 @@ <H3>Force the database management system name</H3>
15711571
</UL>
15721572
</P>
15731573

1574-
<P>It is possible to force the name if you already know it so that sqlmap
1575-
will skip the fingerprint with an exception for MySQL to only identify if
1576-
it is MySQL &lt; 5.0 or MySQL &gt;= 5.0.
1577-
To avoid also this check you can provide instead <CODE>MySQL 4</CODE> or
1578-
<CODE>MySQL 5</CODE>.</P>
1574+
<P>It is possible to force the DBMS name if you already know it so that sqlmap
1575+
will skip the fingerprint with an exception for MySQL and Microsoft SQL
1576+
Server to only identify the version.
1577+
To avoid also this check you can provide instead <CODE>MySQL VERSION</CODE> or
1578+
<CODE>Microsoft SQL Server VERSION</CODE> where version is a valid version for
1579+
the DBMS, for instance <CODE>5.0</CODE> for MySQL and <CODE>2005</CODE> for
1580+
Microsoft SQL Server.</P>
15791581
<P>Example on a <B>PostgreSQL 8.3.5</B> target:</P>
15801582
<P>
15811583
<BLOCKQUOTE><CODE>

doc/README.pdf

-3.05 KB
Binary file not shown.

doc/README.sgml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,11 +1507,13 @@ At the moment the fully supported database management system are four:
15071507
</itemize>
15081508

15091509
<p>
1510-
It is possible to force the name if you already know it so that sqlmap
1511-
will skip the fingerprint with an exception for MySQL to only identify if
1512-
it is MySQL &lt; 5.0 or MySQL &gt;= 5.0.
1513-
To avoid also this check you can provide instead <tt>MySQL 4</tt> or
1514-
<tt>MySQL 5</tt>.
1510+
It is possible to force the DBMS name if you already know it so that sqlmap
1511+
will skip the fingerprint with an exception for MySQL and Microsoft SQL
1512+
Server to only identify the version.
1513+
To avoid also this check you can provide instead <tt>MySQL VERSION</tt> or
1514+
<tt>Microsoft SQL Server VERSION</tt> where version is a valid version for
1515+
the DBMS, for instance <tt>5.0</tt> for MySQL and <tt>2005</tt> for
1516+
Microsoft SQL Server.
15151517

15161518
Example on a <bf>PostgreSQL 8.3.5</bf> target:
15171519

lib/core/option.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
from lib.core.optiondict import optDict
5656
from lib.core.settings import MSSQL_ALIASES
5757
from lib.core.settings import MYSQL_ALIASES
58+
from lib.core.settings import PGSQL_ALIASES
59+
from lib.core.settings import ORACLE_ALIASES
5860
from lib.core.settings import IS_WIN
5961
from lib.core.settings import PLATFORM
6062
from lib.core.settings import SITE
@@ -461,8 +463,10 @@ def __setDBMS():
461463
logger.debug(debugMsg)
462464

463465
conf.dbms = conf.dbms.lower()
464-
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
465-
"|".join([alias for alias in MYSQL_ALIASES]))
466+
firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
467+
"|".join([alias for alias in MYSQL_ALIASES]),
468+
"|".join([alias for alias in PGSQL_ALIASES]),
469+
"|".join([alias for alias in ORACLE_ALIASES]))
466470
dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, conf.dbms)
467471

468472
if dbmsRegExp:

lib/core/session.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
from lib.core.data import logger
3535
from lib.core.settings import MSSQL_ALIASES
3636
from lib.core.settings import MYSQL_ALIASES
37+
from lib.core.settings import PGSQL_ALIASES
38+
from lib.core.settings import ORACLE_ALIASES
3739

3840

3941
def setString():
@@ -133,8 +135,10 @@ def setDbms(dbms):
133135
if condition:
134136
dataToSessionFile("[%s][%s][%s][DBMS][%s]\n" % (conf.url, kb.injPlace, conf.parameters[kb.injPlace], dbms))
135137

136-
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
137-
"|".join([alias for alias in MYSQL_ALIASES]))
138+
firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
139+
"|".join([alias for alias in MYSQL_ALIASES]),
140+
"|".join([alias for alias in PGSQL_ALIASES]),
141+
"|".join([alias for alias in ORACLE_ALIASES]))
138142
dbmsRegExp = re.search("^%s" % firstRegExp, dbms, re.I)
139143

140144
if dbmsRegExp:
@@ -368,20 +372,23 @@ def resumeConfKb(expression, url, value):
368372
logger.info(logMsg)
369373

370374
elif expression == "DBMS" and url == conf.url:
371-
dbms = value[:-1]
375+
dbms = value[:-1]
376+
dbms = dbms.lower()
377+
dbmsVersion = None
372378

373379
logMsg = "resuming back-end DBMS '%s' " % dbms
374380
logMsg += "from session file"
375381
logger.info(logMsg)
376382

377-
dbms = dbms.lower()
378-
firstRegExp = "(%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
379-
"|".join([alias for alias in MYSQL_ALIASES]))
383+
firstRegExp = "(%s|%s|%s|%s)" % ("|".join([alias for alias in MSSQL_ALIASES]),
384+
"|".join([alias for alias in MYSQL_ALIASES]),
385+
"|".join([alias for alias in PGSQL_ALIASES]),
386+
"|".join([alias for alias in ORACLE_ALIASES]))
380387
dbmsRegExp = re.search("%s ([\d\.]+)" % firstRegExp, dbms)
381388

382389
if dbmsRegExp:
383-
dbms = dbmsRegExp.group(1)
384-
kb.dbmsVersion = [ dbmsRegExp.group(2) ]
390+
dbms = dbmsRegExp.group(1)
391+
dbmsVersion = [ dbmsRegExp.group(2) ]
385392

386393
if conf.dbms and conf.dbms.lower() != dbms:
387394
message = "you provided '%s' as back-end DBMS, " % conf.dbms
@@ -392,9 +399,11 @@ def resumeConfKb(expression, url, value):
392399
test = readInput(message, default="N")
393400

394401
if not test or test[0] in ("n", "N"):
395-
conf.dbms = dbms
402+
conf.dbms = dbms
403+
kb.dbmsVersion = dbmsVersion
396404
else:
397-
conf.dbms = dbms
405+
conf.dbms = dbms
406+
kb.dbmsVersion = dbmsVersion
398407

399408
elif expression == "OS" and url == conf.url:
400409
os = value[:-1]

0 commit comments

Comments
 (0)