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

Method _xpCmdshellTest

lib/takeover/xp_cmdshell.py:102–125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

100
101 @stackedmethod
102 def _xpCmdshellTest(self):
103 threadData = getCurrentThreadData()
104 pushValue(threadData.disableStdOut)
105 threadData.disableStdOut = True
106
107 logger.info("testing if xp_cmdshell extended procedure is usable")
108 output = self.xpCmdshellEvalCmd("echo 1")
109
110 if output == "1":
111 logger.info("xp_cmdshell extended procedure is usable")
112 elif isNoneValue(output) and conf.dbmsCred:
113 errMsg = "it seems that the temporary directory ('%s') used for " % self.getRemoteTempPath()
114 errMsg += "storing console output within the back-end file system "
115 errMsg += "does not have writing permissions for the DBMS process. "
116 errMsg += "You are advised to manually adjust it with option "
117 errMsg += "'--tmp-path' or you won't be able to retrieve "
118 errMsg += "the command(s) output"
119 logger.error(errMsg)
120 elif isNoneValue(output):
121 logger.error("unable to retrieve xp_cmdshell output")
122 else:
123 logger.info("xp_cmdshell extended procedure is usable")
124
125 threadData.disableStdOut = popValue()
126
127 def xpCmdshellWriteFile(self, fileContent, tmpPath, randDestFile):
128 echoedLines = []

Callers 1

xpCmdshellInitMethod · 0.95

Calls 8

xpCmdshellEvalCmdMethod · 0.95
getCurrentThreadDataFunction · 0.90
pushValueFunction · 0.90
isNoneValueFunction · 0.90
popValueFunction · 0.90
infoMethod · 0.80
getRemoteTempPathMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected