Extracting Binaries from MIME-Encoded messages

Martin McCormick martin at dc.cis.okstate.edu
Fri Jun 18 15:28:39 UTC 2004


	I use nmh for reading Email.  This user agent places each
incoming message in to a directory with the name of a given folder
such as inbox for all messages that don't belong in other folders.  Is
there a good utility for stripping attachments out of a message when
it may contain one or more?  Right now, I do it by hand when I need to
and I can probably write a program to do it, but I thought I would
check to see if that is necessary.

	The manual process is to copy the message to some scratch
file, run vi on the scratch file and look for base64 which is one type
of encoding, and then strip away all but the garbage of the 7-bit data
which is the base64 representation of the binary.  Then, I run a perl
script that has been out on the Internet for years which is called
base64decode.  It's standard output is the decoded data stream.

	I know that base64 decoding is part of many applications so I
want simply to be able to extract attachments that aren't understood
or can't be displayed such as sound files, etc.

	By the way, it is kind of funny to see some of those spam
messages that claim to be the document I requested or some other
enticement to open them.  When I do extract the binary just for fun
and run strings on it, I see something like w32.dll or a message
stating that this program can't run in DOS.  I saw that on a file that
had a .wav extension.  Some poor Windows user was going to dance to
some pretty bad music if they plaid that file.

Martin McCormick WB5AGZ  Stillwater, OK 
OSU Information Technology Division Network Operations Group





More information about the Blinux-list mailing list