Skip to content

Instantly share code, notes, and snippets.

@FrankSpierings
Created January 9, 2016 16:09
Show Gist options
  • Save FrankSpierings/cfb7246e6e267ce7178c to your computer and use it in GitHub Desktop.
Save FrankSpierings/cfb7246e6e267ce7178c to your computer and use it in GitHub Desktop.
$DebugPreference = "Continue"
function Create-Base64Payload()
{
param(
$Filename
)
$content = (Get-Content -Path $Filename | Out-String)
$command = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($content))
Write-Debug "[+] Mind the newlines!"
Write-Debug "[+] Powershell.exe -EncodedCommand $command"
return $command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment