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

Method xpCmdshellWriteFile

lib/takeover/xp_cmdshell.py:127–154  ·  view source on GitHub ↗
(self, fileContent, tmpPath, randDestFile)

Source from the content-addressed store, hash-verified

125 threadData.disableStdOut = popValue()
126
127 def xpCmdshellWriteFile(self, fileContent, tmpPath, randDestFile):
128 echoedLines = []
129 cmd = ""
130 charCounter = 0
131 maxLen = 512
132
133 if isinstance(fileContent, (set, list, tuple)):
134 lines = fileContent
135 else:
136 lines = fileContent.split("\n")
137
138 for line in lines:
139 echoedLine = "echo %s " % line
140 echoedLine += ">> \"%s\\%s\"" % (tmpPath, randDestFile)
141 echoedLines.append(echoedLine)
142
143 for echoedLine in echoedLines:
144 cmd += "%s & " % echoedLine
145 charCounter += len(echoedLine)
146
147 if charCounter >= maxLen:
148 self.xpCmdshellExecCmd(cmd.rstrip(" & "))
149
150 cmd = ""
151 charCounter = 0
152
153 if cmd:
154 self.xpCmdshellExecCmd(cmd.rstrip(" & "))
155
156 def xpCmdshellForgeCmd(self, cmd, insertIntoTable=None):
157 # When user provides DBMS credentials (with --dbms-cred) we need to

Callers 4

_updateDestChunkMethod · 0.80
_stackedWriteFilePSMethod · 0.80
_stackedWriteFileVbsMethod · 0.80

Calls 2

xpCmdshellExecCmdMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected