mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 20:51:31 +00:00
Some more PEPing (I hope that I haven't broke anything)
This commit is contained in:
@@ -73,10 +73,13 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
logger.debug("generating chunk file %s\%s from debug script %s" % (tmpPath, chunkName, randScr))
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, "debug < %s" % randScr, "del /F /Q %s" % randScr)
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
"debug < %s" % randScr,
|
||||
"del /F /Q %s" % randScr
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
return chunkName
|
||||
|
||||
@@ -195,12 +198,13 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
logger.debug("executing the PowerShell base64-decoding script to write the %s file, please wait.." % dFile)
|
||||
|
||||
commands = ("powershell -ExecutionPolicy ByPass -File \"%s\"" % randPSScriptPath,
|
||||
"del /F /Q \"%s\"" % encodedBase64FilePath,
|
||||
"del /F /Q \"%s\"" % randPSScriptPath)
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"powershell -ExecutionPolicy ByPass -File \"%s\"" % randPSScriptPath,
|
||||
"del /F /Q \"%s\"" % encodedBase64FilePath,
|
||||
"del /F /Q \"%s\"" % randPSScriptPath
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
def _stackedWriteFileDebugExe(self, tmpPath, wFile, wFileContent, dFile, fileType):
|
||||
infoMsg = "using debug.exe to write the %s " % fileType
|
||||
@@ -219,10 +223,13 @@ class Filesystem(GenericFilesystem):
|
||||
debugMsg += "file %s\%s and moving it to %s" % (tmpPath, dFileName, dFile)
|
||||
logger.debug(debugMsg)
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, "ren %s %s" % (chunkName, dFileName), "move /Y %s %s" % (dFileName, dFile))
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
"ren %s %s" % (chunkName, dFileName),
|
||||
"move /Y %s %s" % (dFileName, dFile)
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
else:
|
||||
debugMsg = "the file is larger than %d bytes. " % debugSize
|
||||
debugMsg += "sqlmap will split it into chunks locally, upload "
|
||||
@@ -244,17 +251,22 @@ class Filesystem(GenericFilesystem):
|
||||
debugMsg += "%s\%s to %s file %s\%s" % (tmpPath, chunkName, fileType, tmpPath, dFileName)
|
||||
logger.debug(debugMsg)
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, copyCmd, "del /F /Q %s" % chunkName)
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
copyCmd,
|
||||
"del /F /Q %s" % chunkName
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
logger.debug("moving %s file %s to %s" % (fileType, sFile, dFile))
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, "move /Y %s %s" % (dFileName, dFile))
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
"move /Y %s %s" % (dFileName, dFile)
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
def _stackedWriteFileVbs(self, tmpPath, wFileContent, dFile, fileType):
|
||||
infoMsg = "using a custom visual basic script to write the "
|
||||
@@ -330,12 +342,14 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
self.xpCmdshellWriteFile(vbs, tmpPath, randVbs)
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, "cscript //nologo %s" % randVbs,
|
||||
"del /F /Q %s" % randVbs,
|
||||
"del /F /Q %s" % randFile)
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
"cscript //nologo %s" % randVbs,
|
||||
"del /F /Q %s" % randVbs,
|
||||
"del /F /Q %s" % randFile
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
def _stackedWriteFileCertutilExe(self, tmpPath, wFile, wFileContent, dFile, fileType):
|
||||
infoMsg = "using certutil.exe to write the %s " % fileType
|
||||
@@ -349,7 +363,7 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
encodedFileContent = base64encode(wFileContent)
|
||||
|
||||
splittedEncodedFileContent = '\n'.join([encodedFileContent[i:i+chunkMaxSize] for i in xrange(0, len(encodedFileContent), chunkMaxSize)])
|
||||
splittedEncodedFileContent = '\n'.join([encodedFileContent[i:i + chunkMaxSize] for i in xrange(0, len(encodedFileContent), chunkMaxSize)])
|
||||
|
||||
logger.debug("uploading the file base64-encoded content to %s, please wait.." % randFilePath)
|
||||
|
||||
@@ -357,11 +371,13 @@ class Filesystem(GenericFilesystem):
|
||||
|
||||
logger.debug("decoding the file to %s.." % dFile)
|
||||
|
||||
commands = ("cd \"%s\"" % tmpPath, "certutil -f -decode %s %s" % (randFile, dFile),
|
||||
"del /F /Q %s" % randFile)
|
||||
complComm = " & ".join(command for command in commands)
|
||||
commands = (
|
||||
"cd \"%s\"" % tmpPath,
|
||||
"certutil -f -decode %s %s" % (randFile, dFile),
|
||||
"del /F /Q %s" % randFile
|
||||
)
|
||||
|
||||
self.execCmd(complComm)
|
||||
self.execCmd(" & ".join(command for command in commands))
|
||||
|
||||
def stackedWriteFile(self, wFile, dFile, fileType, forceCheck=False):
|
||||
# NOTE: this is needed here because we use xp_cmdshell extended
|
||||
|
||||
Reference in New Issue
Block a user