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

Method checkDbmsOs

plugins/dbms/postgresql/fingerprint.py:204–233  ·  view source on GitHub ↗
(self, detailed=False)

Source from the content-addressed store, hash-verified

202 return False
203
204 def checkDbmsOs(self, detailed=False):
205 if Backend.getOs():
206 return
207
208 infoMsg = "fingerprinting the back-end DBMS operating system"
209 logger.info(infoMsg)
210
211 self.createSupportTbl(self.fileTblName, self.tblField, "character(10000)")
212 inject.goStacked("INSERT INTO %s(%s) VALUES (%s)" % (self.fileTblName, self.tblField, "VERSION()"))
213
214 # Windows executables should always have ' Visual C++' or ' mingw'
215 # patterns within the banner
216 osWindows = (" Visual C++", "mingw")
217
218 for osPattern in osWindows:
219 query = "(SELECT LENGTH(%s) FROM %s WHERE %s " % (self.tblField, self.fileTblName, self.tblField)
220 query += "LIKE '%" + osPattern + "%')>0"
221
222 if inject.checkBooleanExpression(query):
223 Backend.setOs(OS.WINDOWS)
224
225 break
226
227 if Backend.getOs() is None:
228 Backend.setOs(OS.LINUX)
229
230 infoMsg = "the back-end DBMS operating system is %s" % Backend.getOs()
231 logger.info(infoMsg)
232
233 self.cleanup(onlyFileTbl=True)

Callers

nothing calls this directly

Calls 5

infoMethod · 0.80
createSupportTblMethod · 0.80
setOsMethod · 0.80
cleanupMethod · 0.80
getOsMethod · 0.45

Tested by

no test coverage detected