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

Method osSmb

plugins/generic/takeover.py:283–331  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

281 self.cleanup(web=web)
282
283 def osSmb(self):
284 self.checkDbmsOs()
285
286 if not Backend.isOs(OS.WINDOWS):
287 errMsg = "the back-end DBMS underlying operating system is "
288 errMsg += "not Windows: it is not possible to perform the SMB "
289 errMsg += "relay attack"
290 raise SqlmapUnsupportedDBMSException(errMsg)
291
292 if not isStackingAvailable() and not conf.direct:
293 if Backend.getIdentifiedDbms() in (DBMS.PGSQL, DBMS.MSSQL):
294 errMsg = "on this back-end DBMS it is only possible to "
295 errMsg += "perform the SMB relay attack if stacked "
296 errMsg += "queries are supported"
297 raise SqlmapUnsupportedDBMSException(errMsg)
298
299 elif Backend.isDbms(DBMS.MYSQL):
300 debugMsg = "since stacked queries are not supported, "
301 debugMsg += "sqlmap is going to perform the SMB relay "
302 debugMsg += "attack via inference blind SQL injection"
303 logger.debug(debugMsg)
304
305 printWarn = True
306 warnMsg = "it is unlikely that this attack will be successful "
307
308 if Backend.isDbms(DBMS.MYSQL):
309 warnMsg += "because by default MySQL on Windows runs as "
310 warnMsg += "Local System which is not a real user, it does "
311 warnMsg += "not send the NTLM session hash when connecting to "
312 warnMsg += "a SMB service"
313
314 elif Backend.isDbms(DBMS.PGSQL):
315 warnMsg += "because by default PostgreSQL on Windows runs "
316 warnMsg += "as postgres user which is a real user of the "
317 warnMsg += "system, but not within the Administrators group"
318
319 elif Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
320 warnMsg += "because often Microsoft SQL Server %s " % Backend.getVersion()
321 warnMsg += "runs as Network Service which is not a real user, "
322 warnMsg += "it does not send the NTLM session hash when "
323 warnMsg += "connecting to a SMB service"
324
325 else:
326 printWarn = False
327
328 if printWarn:
329 logger.warning(warnMsg)
330
331 self.smb()
332
333 def osBof(self):
334 if not isStackingAvailable() and not conf.direct:

Callers 1

actionFunction · 0.45

Calls 10

isStackingAvailableFunction · 0.90
isOsMethod · 0.80
getIdentifiedDbmsMethod · 0.80
isDbmsMethod · 0.80
debugMethod · 0.80
isVersionWithinMethod · 0.80
getVersionMethod · 0.80
smbMethod · 0.80
checkDbmsOsMethod · 0.45

Tested by

no test coverage detected