uudecode

encode / decode base64 file

I use squrrelmail in text mode and recently I've had to retrieve a password at Dell. The reset password email however comes with html embeded in base64 encoded text. So my webmail did not show up the embeded html link. With some knowledge of uudecode, I was able to view the exact link to reset the password.

The sharutils package contains the GNU utilities uuencode and uudecode.

Here's a brief background and usage:

uuencode is a program that encodes binary files as plain ASCII text so that they can be sent through electronic mail. The program expands single characters that can't be viewed or printed as normal text into pairs of text characters, and the resulting encoded file is somewhat larger than the original binary file. This process is necessary to prevent mail, news, and terminal programs from misinterpreting the non-text characters in binary files as special instructions.

$ cat test.txt
hello world!

$ uuencode -m test.txt test.txt > test.txt.base64

$ cat test.txt.base64
begin-base64 644 test.txt
CmhlbGxvIHdvcmxkIQoKCg==
====

$ rm test.txt

$ uudecode test.txt.base64

$ cat test.txt
hello world!

First I copied over the actual base64 encoded text from my local email folder which looks similar to:

$ cat dell_reset
DQpUaGlzIGVtYWlsIHdhcyBzZW50IHRvIHlvdSBpbiByZXNwb25zZSB0byB5b3VyIHJlcXVl
... ...
bGluayBoYXMgYSBsaWZlIHNwYW4gb2YgdGhyZWUgZGF5cyBvbmx5LjxiciAvPg0KPGJyIC8+DQo=

I then added text in the beginning and end to specify the base64 encoded as below:

$ cat - dell_reset <<<"begin-base64 644 dell_reset.txt" > dell_reset.base64
$ echo "====" >> dell_reset.base64
$ cat dell_reset.base64
begin-base64 644 dell_reset.txt
DQpUaGlzIGVtYWlsIHdhcyBzZW50IHRvIHlvdSBpbiByZXNwb25zZSB0byB5b3VyIHJlcXVl
... ...
bGluayBoYXMgYSBsaWZlIHNwYW4gb2YgdGhyZWUgZGF5cyBvbmx5LjxiciAvPg0KPGJyIC8+DQo=
====

The text was then decoded using:

$ uudecode dell_reset.base64
$ cat dell_reset.txt
This email was sent to you in response to your request to modify your Dell.com account.<br />

Click the link below to go to the Dell site and modify your account:<br />
... ...

Comment