byt3bl33d3r
Published

Tue 30 June 2015

←Home

Converting commands to Powershell compatible encoded strings for dummies

This is basically a reminder for me but could be useful for anyone. I keep forgetting how to convert commands to a Powershell compatible encoded string:

From the command line:

echo "iex(command)" | iconv --to-code UTF-16LE | base64 -w 0

For Python:

from base64 import b64encode
b64encode('iex(command)'.encode('UTF-16LE'))

For Ruby:

require "base64"
Base64.encode64('iex(command)'.force_encoding('UTF-16LE'))
Go Top