Skip to content

Instantly share code, notes, and snippets.

@curi0usJack
Created March 15, 2017 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save curi0usJack/1eef9d94a01344bddafec7434412ec66 to your computer and use it in GitHub Desktop.
Save curi0usJack/1eef9d94a01344bddafec7434412ec66 to your computer and use it in GitHub Desktop.
Obfuscate Command in your Clipboard (even if base64 encoded).
function obs()
{
Import-Module Invoke-Obfuscation
$s = Get-Clipboard
if ($s -eq $null)
{
Write-Host "Clipboard is nulll."
}
else
{
try {
$dec_bytes = [System.Convert]::FromBase64String($s)
$dec_string = [System.Text.Encoding]::Unicode.GetString($dec_bytes)
}
catch {
# Command is not b64 encoded
$dec_string = @'
$($s)
'@
}
$obfs = Out-StringDelimitedAndConcatenated $dec_string
$enc_bytes = [System.Text.Encoding]::Unicode.GetBytes($obfs)
$enc_string = [System.Convert]::ToBase64String($enc_bytes)
$output = "powershell.exe -NoP -sta -NonI -W 1 -Enc $enc_string"
$output | clip
Write-Host "[+] Obfuscated command copied to clipboard."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment