Decode base64 with PowerShell

Hello

If you look at PowerShell’s help, you’ll see that you can use base64 as a parameter :

PowerShell /?

PowerShellHelp

Like this :

$encodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes("'Hello World !'"))
PowerShell.exe -EncodedCommand $encodedCommand

EncodedCommand

Problem : The base64 is quite obfuscated :

EncodedCommand-2

Solution :

[System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedCommand))

EncodedCommand-3

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.