Title: Encoding and Decoding Base64 used in Penetration TestingAuthor: ajayverma
Often in the info world you’ll run into plenty of Base64 encoded strings. A typical giveaway is the trailing = or == in many cases.


Basic Syntax

base64 -i <file>
base64 -di <file>

-i : Useful for ignoring garbage.
-d : Decode, without this flag it will encode.

Example – Encoding Base64

echo The quick brown fox jumped over the lazy dog> encode.txt
base64 -i encode.txt
>> VGhlIHF1aWNrIGJyb3duIGRvZyBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cuLi4K

Example – Decoding Base64

echo VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cuLi4=> decode.txt
base64 -di decode.txt
>> The quick brown fox jumped over the lazy dog…

Obviously you can also do this without going via a file directly on the command line with piping.

Submitted On: 2019-05-30 12:51:13