MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / checkDbms

Method checkDbms

plugins/dbms/mysql/fingerprint.py:167–320  ·  view source on GitHub ↗

References for fingerprint: * http://dev.mysql.com/doc/refman/5.0/en/news-5-0-x.html (up to 5.0.89) * http://dev.mysql.com/doc/refman/5.1/en/news-5-1-x.html (up to 5.1.42) * http://dev.mysql.com/doc/refman/5.4/en/news-5-4-x.html (up to 5.4.4) * http://dev.my

(self)

Source from the content-addressed store, hash-verified

165 return value
166
167 def checkDbms(self):
168 """
169 References for fingerprint:
170
171 * http://dev.mysql.com/doc/refman/5.0/en/news-5-0-x.html (up to 5.0.89)
172 * http://dev.mysql.com/doc/refman/5.1/en/news-5-1-x.html (up to 5.1.42)
173 * http://dev.mysql.com/doc/refman/5.4/en/news-5-4-x.html (up to 5.4.4)
174 * http://dev.mysql.com/doc/refman/5.5/en/news-5-5-x.html (up to 5.5.0)
175 * http://dev.mysql.com/doc/refman/6.0/en/news-6-0-x.html (manual has been withdrawn)
176 """
177
178 if not conf.extensiveFp and Backend.isDbmsWithin(MYSQL_ALIASES):
179 setDbms("%s %s" % (DBMS.MYSQL, Backend.getVersion()))
180
181 if Backend.isVersionGreaterOrEqualThan("5") or inject.checkBooleanExpression("DATABASE() LIKE SCHEMA()"):
182 kb.data.has_information_schema = True
183 self.getBanner()
184
185 return True
186
187 infoMsg = "testing %s" % DBMS.MYSQL
188 logger.info(infoMsg)
189
190 result = inject.checkBooleanExpression("IFNULL(QUARTER(NULL),NULL XOR NULL) IS NULL")
191
192 if result:
193 infoMsg = "confirming %s" % DBMS.MYSQL
194 logger.info(infoMsg)
195
196 result = inject.checkBooleanExpression("COALESCE(SESSION_USER(),USER()) IS NOT NULL")
197
198 if not result:
199 # Note: MemSQL doesn't support SESSION_USER()
200 result = inject.checkBooleanExpression("GEOGRAPHY_AREA(NULL) IS NULL")
201
202 if result:
203 hashDBWrite(HASHDB_KEYS.DBMS_FORK, FORK.MEMSQL)
204
205 if not result:
206 warnMsg = "the back-end DBMS is not %s" % DBMS.MYSQL
207 logger.warning(warnMsg)
208
209 return False
210
211 # reading information_schema on some platforms is causing annoying timeout exits
212 # Reference: http://bugs.mysql.com/bug.php?id=15855
213
214 kb.data.has_information_schema = True
215
216 # Determine if it is MySQL >= 9.0.0
217 if inject.checkBooleanExpression("ISNULL(VECTOR_DIM(NULL))"):
218 Backend.setVersion(">= 9.0.0")
219 setDbms("%s 9" % DBMS.MYSQL)
220 self.getBanner()
221
222 # Determine if it is MySQL >= 8.0.0
223 elif inject.checkBooleanExpression("ISNULL(JSON_STORAGE_FREE(NULL))"):
224 Backend.setVersion(">= 8.0.0")

Callers

nothing calls this directly

Calls 9

setDbmsFunction · 0.90
hashDBWriteFunction · 0.90
isDbmsWithinMethod · 0.80
getVersionMethod · 0.80
infoMethod · 0.80
setVersionMethod · 0.80
setVersionListMethod · 0.80
getBannerMethod · 0.45

Tested by

no test coverage detected