How to encode bash commands into base64 (to run secret commands)

Ever wanted to run a secret command on your
machine or someone else’s, Here a way to do that.

The idea began when trying to encode an evil
command that when someone sees he(or she)
has to decode it first to be able to read it,
And what’s the first encoding that goes to mind?

Encoding the “ls” command

let’s assume that we want to run the ls command…
how can we encode it into base64 then run it?!

let’s take it in a step by step process,
at first we encode the command with:

echo "ls" | base64

we’ve got bHMK,

Putting it together

now let’s put the command together

We want to decode it then execute it in the same command
the command would be:

echo 'bHMK' | base64 -d | bash

When you run this command it runs ls

Automate this process

Actually I created a python script to automate this process
which you can find HERE in my GitHub repo

And a quote:


I said it, as always


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s