uudecode: Decode ‘.doc’ files embedded into your mail
by Amit
Context: I recieved a mail, supposedly containing a ‘.doc’ attachment. However, instead of a ‘separate’ file, I see that for some unknown reason the file contents have been appended to the mail body and appeared something like this:
begin 644 60.doc
MT,\1X*&Q&N$`````````````````````/@`#`/[_"0`&```````````````!
M````(@``````````$```)`````$```#^____`````"$```#_____________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M_______________________LI<$`(V`)!```\!*_````````$```````!@``
MF@D```X`8FIB:J$5H14````````````````````````)!!8`+A```,-_``##
.
.
.
What you see above is the binary encoded data of the ‘.doc’ attachment. So how do you get back the proper human readable’.doc’ file?
‘uudecode’ to the rescue
A description of the command is reproduced from here:
The uudecode utility shall read a file, or standard input if no file is specified, that includes data created by the uuencode utility. The uudecode utility shall scan the input file, searching for data compatible with one of the formats specified in uuencode, and attempt to create or overwrite the file described by the data (or overridden by the -o option). The pathname shall be contained in the data or specified by the -o option. The file access permission bits and contents for the file to be produced shall be contained in that data. The mode bits of the created file (other than standard output) shall be set from the file access permission bits contained in the data; that is, other attributes of the mode, including the file mode creation mask (see umask() ), shall not affect the file being produced. If either of the op characters ‘+’ and ‘-‘ (see chmod) are specified in symbolic mode, the initial mode on which those operations are based is unspecified.
If the pathname of the file to be produced exists, and the user does not have write permission on that file, uudecode shall terminate with an error. If the pathname of the file to be produced exists, and the user has write permission on that file, the existing file shall be overwritten.
If the input data was produced by uuencode on a system with a different number of bits per byte than on the target system, the results of uudecode are unspecified.
Installing ‘uudecode’
On my Ubuntu 7.04 system, I installed ‘uudecode’ by using:
amit@ubuntu-laptop:~$ sudo apt-get install sharutils
Decoding your files
To decode your files, copy the encoded text into a file, say demo.doc and use the following command
amit@ubuntu-laptop:/media/sda5$ uudecode demo.doc
Subsequently you will see that a new file by the name as originally desired is created. The original file name may be found out by looking at beginning of the encoded file. Here, it is ’60.doc’.
Then you can view the contents using OpenOffice.org or M$ Word
More Information:
Interesting post. I have been wondering about this issue,so thanks for posting. I’ll likely be coming back to your blog. Keep up great writing. Find your great Travel News and sing the songs at Free Song Lyric or you can watch the drama at Korea Drama Online one of great korea drama is A Love to Kill if you go to travel to Indonesia learn Learn Indonesia Language first! And find your home cari rumah or make a blog Belajar membuat Blog find your home again rumah dijual and again at jual rumah the point is cari rumah, jual rumah, rumah dijual, download youtube and find blog widget and then if you want buy a new laptop see the Laptop Price List or you can buy a New Blackberry and then take care your Health & Jewerly good job, very great article Cari Rumah, Jual Rumah, Rumah dijual Thanks ever so much Cari Rumah, Jual Rumah, Rumah dijual very useful article Cari Rumah, Jual Rumah, Rumah dijual Great information Cari Rumah, Jual Rumah, Rumah dijual I like your blog Cari Rumah, Jual Rumah, Rumah dijual I will be checking back for any new articles Cari Rumah, Jual Rumah, Rumah dijual just bookmarked it for later reference Cari Rumah, Jual Rumah, Rumah dijual. Thanks for kindly sharing it with us. Very well done indeed