Skip to content

Instantly share code, notes, and snippets.

@cryptolok
Created September 3, 2017 14:39
Show Gist options
  • Save cryptolok/8cab23efafa936c41b6131540737b710 to your computer and use it in GitHub Desktop.
Save cryptolok/8cab23efafa936c41b6131540737b710 to your computer and use it in GitHub Desktop.
PowerShell script Base64 encoder/obfuscator in BASH
#!/bin/bash
# PowerShell script Base64 encoder/obfuscator in BASH
PS=$1
if [[ -e "$PS" ]]
then
B64=$(iconv -t utf16le $PS | base64 | tr -d '\n')
# echo "powershell.exe -ExecutionPolicy ByPass -EncodedCommand $B64"
echo "PoWerSHelL -eNc $B64"
else
echo 'Usage : ps2b64 $PS_SCRIPT'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment