My Contribution / Reference / Spare Time

In some cases we want to hide the command to prevent users from seeing it as a clear text. PowerShell has a way of running Base64 encoded commands using -EncodedCommand Parameter

Powershell Help

Powershell Help

Base64 encoded string of a set of characters that contains only a-z, A-Z, 0-9, + and / and is often used in situations when sending non-text information via a text only transmission .




Script
##############################################################################
##
## PowerShell Encoded Command
## by Siva Mulpuru
##
##############################################################################

cls
$cmd = 'Write-Host "This is a Encrypted Text"'
#encodes the characters, and returns the resulting bytes.
$ubytes = [System.Text.Encoding]::Unicode.GetBytes($cmd)
#Converts to Base64String; Refer - http://www.hcidata.info/base64.htm for indepth Base 64 Encoding
$encodedcmd = [Convert]::ToBase64String($ubytes) 

write-Host "Encoded String is `n$encodedcmd"  

write-Host "Running Encoded Command -->  " -NoNewline
Powershell.exe -EncodedCommand $encodedcmd




Output

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Tag Cloud

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: