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

Method stackedWriteFile

plugins/dbms/mssqlserver/filesystem.py:386–426  ·  view source on GitHub ↗
(self, localFile, remoteFile, fileType, forceCheck=False)

Source from the content-addressed store, hash-verified

384 self.execCmd(" & ".join(command for command in commands))
385
386 def stackedWriteFile(self, localFile, remoteFile, fileType, forceCheck=False):
387 # NOTE: this is needed here because we use xp_cmdshell extended
388 # procedure to write a file on the back-end Microsoft SQL Server
389 # file system
390 self.initEnv()
391 self.getRemoteTempPath()
392
393 tmpPath = posixToNtSlashes(conf.tmpPath)
394 remoteFile = posixToNtSlashes(remoteFile)
395
396 checkFile(localFile)
397 localFileContent = open(localFile, "rb").read()
398
399 self._stackedWriteFilePS(tmpPath, localFileContent, remoteFile, fileType)
400 written = self.askCheckWrittenFile(localFile, remoteFile, forceCheck)
401
402 if written is False:
403 message = "do you want to try to upload the file with "
404 message += "the custom Visual Basic script technique? [Y/n] "
405
406 if readInput(message, default='Y', boolean=True):
407 self._stackedWriteFileVbs(tmpPath, localFileContent, remoteFile, fileType)
408 written = self.askCheckWrittenFile(localFile, remoteFile, forceCheck)
409
410 if written is False:
411 message = "do you want to try to upload the file with "
412 message += "the built-in debug.exe technique? [Y/n] "
413
414 if readInput(message, default='Y', boolean=True):
415 self._stackedWriteFileDebugExe(tmpPath, localFile, localFileContent, remoteFile, fileType)
416 written = self.askCheckWrittenFile(localFile, remoteFile, forceCheck)
417
418 if written is False:
419 message = "do you want to try to upload the file with "
420 message += "the built-in certutil.exe technique? [Y/n] "
421
422 if readInput(message, default='Y', boolean=True):
423 self._stackedWriteFileCertutilExe(tmpPath, localFile, localFileContent, remoteFile, fileType)
424 written = self.askCheckWrittenFile(localFile, remoteFile, forceCheck)
425
426 return written

Callers

nothing calls this directly

Calls 11

_stackedWriteFilePSMethod · 0.95
askCheckWrittenFileMethod · 0.95
_stackedWriteFileVbsMethod · 0.95
posixToNtSlashesFunction · 0.90
checkFileFunction · 0.90
readInputFunction · 0.90
initEnvMethod · 0.80
getRemoteTempPathMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected