Skip to content

Commit ef04c99

Browse files
committed
No more dumb usage of '--dbms'
1 parent e2fb16c commit ef04c99

15 files changed

Lines changed: 30 additions & 41 deletions

File tree

lib/core/common.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,9 @@ def getArch():
517517
# Comparison methods
518518
@staticmethod
519519
def isDbms(dbms):
520-
if Backend.getDbms() is not None:
521-
return Backend.getDbms() == aliasToDbmsEnum(dbms)
522-
else:
523-
return Backend.getIdentifiedDbms() == aliasToDbmsEnum(dbms)
520+
if not kb.get("testMode") and all((Backend.getDbms(), Backend.getIdentifiedDbms())) and Backend.getDbms() != Backend.getIdentifiedDbms():
521+
singleTimeWarnMessage("identified ('%s') and fingerprinted ('%s') DBMSes differ. If you experience problems in enumeration phase please rerun with '--flush-session'" % (Backend.getIdentifiedDbms(), Backend.getDbms()))
522+
return Backend.getIdentifiedDbms() == aliasToDbmsEnum(dbms)
524523

525524
@staticmethod
526525
def isDbmsWithin(aliases):

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.1.3.3"
22+
VERSION = "1.1.3.4"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/access/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def getFingerprint(self):
146146
return value
147147

148148
def checkDbms(self):
149-
if not conf.extensiveFp and (Backend.isDbmsWithin(ACCESS_ALIASES) or (conf.dbms or "").lower() in ACCESS_ALIASES):
149+
if not conf.extensiveFp and Backend.isDbmsWithin(ACCESS_ALIASES):
150150
setDbms(DBMS.ACCESS)
151151

152152
return True

plugins/dbms/db2/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def getFingerprint(self):
8181
return value
8282

8383
def checkDbms(self):
84-
if not conf.extensiveFp and (Backend.isDbmsWithin(DB2_ALIASES) or (conf.dbms or "").lower() in DB2_ALIASES):
84+
if not conf.extensiveFp and Backend.isDbmsWithin(DB2_ALIASES):
8585
setDbms(DBMS.DB2)
8686

8787
return True

plugins/dbms/firebird/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def _dialectCheck(self):
103103
return retVal
104104

105105
def checkDbms(self):
106-
if not conf.extensiveFp and (Backend.isDbmsWithin(FIREBIRD_ALIASES) \
107-
or (conf.dbms or "").lower() in FIREBIRD_ALIASES) and Backend.getVersion() and \
108-
Backend.getVersion() != UNKNOWN_DBMS_VERSION:
106+
if not conf.extensiveFp and Backend.isDbmsWithin(FIREBIRD_ALIASES):
109107
setDbms("%s %s" % (DBMS.FIREBIRD, Backend.getVersion()))
110108

111109
self.getBanner()

plugins/dbms/hsqldb/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ def checkDbms(self):
8080
8181
"""
8282

83-
if not conf.extensiveFp and (Backend.isDbmsWithin(HSQLDB_ALIASES) \
84-
or (conf.dbms or "").lower() in HSQLDB_ALIASES) and Backend.getVersion() and \
85-
Backend.getVersion() != UNKNOWN_DBMS_VERSION:
83+
if not conf.extensiveFp and Backend.isDbmsWithin(HSQLDB_ALIASES):
8684
setDbms("%s %s" % (DBMS.HSQLDB, Backend.getVersion()))
8785

8886
if Backend.isVersionGreaterOrEqualThan("1.7.2"):

plugins/dbms/informix/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def getFingerprint(self):
5656
return value
5757

5858
def checkDbms(self):
59-
if not conf.extensiveFp and (Backend.isDbmsWithin(INFORMIX_ALIASES) or (conf.dbms or "").lower() in INFORMIX_ALIASES):
59+
if not conf.extensiveFp and Backend.isDbmsWithin(INFORMIX_ALIASES):
6060
setDbms(DBMS.INFORMIX)
6161

6262
self.getBanner()

plugins/dbms/maxdb/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def getFingerprint(self):
9191
return value
9292

9393
def checkDbms(self):
94-
if not conf.extensiveFp and (Backend.isDbmsWithin(MAXDB_ALIASES) or (conf.dbms or "").lower() in MAXDB_ALIASES):
94+
if not conf.extensiveFp and Backend.isDbmsWithin(MAXDB_ALIASES):
9595
setDbms(DBMS.MAXDB)
9696

9797
self.getBanner()

plugins/dbms/mssqlserver/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ def getFingerprint(self):
6565
return value
6666

6767
def checkDbms(self):
68-
if not conf.extensiveFp and (Backend.isDbmsWithin(MSSQL_ALIASES) \
69-
or (conf.dbms or "").lower() in MSSQL_ALIASES) and Backend.getVersion() and \
70-
Backend.getVersion().isdigit():
68+
if not conf.extensiveFp and Backend.isDbmsWithin(MSSQL_ALIASES):
7169
setDbms("%s %s" % (DBMS.MSSQL, Backend.getVersion()))
7270

7371
self.getBanner()

plugins/dbms/mysql/fingerprint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ def checkDbms(self):
150150
* http://dev.mysql.com/doc/refman/6.0/en/news-6-0-x.html (manual has been withdrawn)
151151
"""
152152

153-
if not conf.extensiveFp and (Backend.isDbmsWithin(MYSQL_ALIASES) \
154-
or (conf.dbms or "").lower() in MYSQL_ALIASES) and Backend.getVersion() and \
155-
Backend.getVersion() != UNKNOWN_DBMS_VERSION:
153+
if not conf.extensiveFp and Backend.isDbmsWithin(MYSQL_ALIASES):
156154
setDbms("%s %s" % (DBMS.MYSQL, Backend.getVersion()))
157155

158156
if Backend.isVersionGreaterOrEqualThan("5"):

0 commit comments

Comments
 (0)