From 0c1b3f2dbccc580e3706d37e6ba59e29352cdcae Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Mon, 30 Jun 2014 20:39:21 +0100 Subject: [PATCH] more on issue #742 --- plugins/dbms/mssqlserver/filesystem.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/plugins/dbms/mssqlserver/filesystem.py b/plugins/dbms/mssqlserver/filesystem.py index 4cb3a7440..5bfd4cd5d 100644 --- a/plugins/dbms/mssqlserver/filesystem.py +++ b/plugins/dbms/mssqlserver/filesystem.py @@ -173,18 +173,7 @@ class Filesystem(GenericFilesystem): randPSScriptPath = "%s\%s" % (tmpPath, randPSScript) encodedFileContent = base64encode(wFileContent) - #psString = "[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String(\"%s\")) | Out-File \"%s\"" % (encodedFileContent, dFile) - psString = "[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String(\"%s\")) ^> \"%s\"" % (encodedFileContent, dFile) - #psString = "[System.Text.Encoding]::UTF8.GetBytes([System.Convert]::FromBase64String(\"%s\")) | Out-File \"%s\"" % (encodedFileContent, dFile) - #psString = "[System.Text.Encoding]::UTF8.GetBytes([System.Convert]::FromBase64String(\"%s\")) ^> \"%s\"" % (encodedFileContent, dFile) - #psString = """$Content = Get-Content -Path %s -Encoding Byte - #$Base64 = [System.Convert]::ToBase64String($Content) - psString = """ - $Content = [System.Convert]::FromBase64String("%s") - Set-Content -Path %s -Value $Content -Encoding Byte - """ % (encodedFileContent, randPSScriptPath) - - psString = psString.replace(" ", "").replace("\n", ";") + psString = "$Content = [System.Convert]::FromBase64String(\"%s\"); Set-Content -Path \"%s\" -Value $Content -Encoding Byte" % (encodedFileContent, dFile) logger.debug("uploading the PowerShell script to %s, please wait.." % randPSScriptPath) self.xpCmdshellWriteFile(psString, tmpPath, randPSScript)