Skip to content

Commit 0c1b3f2

Browse files
committed
more on issue sqlmapproject#742
1 parent ce67156 commit 0c1b3f2

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

plugins/dbms/mssqlserver/filesystem.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,7 @@ def _stackedWriteFilePS(self, tmpPath, wFileContent, dFile, fileType):
173173
randPSScriptPath = "%s\%s" % (tmpPath, randPSScript)
174174

175175
encodedFileContent = base64encode(wFileContent)
176-
#psString = "[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String(\"%s\")) | Out-File \"%s\"" % (encodedFileContent, dFile)
177-
psString = "[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String(\"%s\")) ^> \"%s\"" % (encodedFileContent, dFile)
178-
#psString = "[System.Text.Encoding]::UTF8.GetBytes([System.Convert]::FromBase64String(\"%s\")) | Out-File \"%s\"" % (encodedFileContent, dFile)
179-
#psString = "[System.Text.Encoding]::UTF8.GetBytes([System.Convert]::FromBase64String(\"%s\")) ^> \"%s\"" % (encodedFileContent, dFile)
180-
#psString = """$Content = Get-Content -Path %s -Encoding Byte
181-
#$Base64 = [System.Convert]::ToBase64String($Content)
182-
psString = """
183-
$Content = [System.Convert]::FromBase64String("%s")
184-
Set-Content -Path %s -Value $Content -Encoding Byte
185-
""" % (encodedFileContent, randPSScriptPath)
186-
187-
psString = psString.replace(" ", "").replace("\n", ";")
176+
psString = "$Content = [System.Convert]::FromBase64String(\"%s\"); Set-Content -Path \"%s\" -Value $Content -Encoding Byte" % (encodedFileContent, dFile)
188177

189178
logger.debug("uploading the PowerShell script to %s, please wait.." % randPSScriptPath)
190179
self.xpCmdshellWriteFile(psString, tmpPath, randPSScript)

0 commit comments

Comments
 (0)