Bill Bumgarner


Make Spam [sorta] Useful

I get a lot of spam. Huge amounts. Fortunately, Mail is quite good at filtering it into a mailbox that I periodically delete. But, still, if the damned stuff is going to pass through my system, it might as well do something useful along the way.

So I wrote a little Apple Script that can be used in a filter rule that sucks out the first 2084 characters each message filtered into Junk Mail and writes those characters to /dev/random, thus contributing to the entropy-- the randomness-- of the system's pseudo-random number generator. Lots of things use random numbers, including various encryption mechanisms, so increasing the quality of the random numbers generated by the system should also increase system security.

In practice, it is just a silly hack that won't make much of a difference.

You can grab the script and install it by adding it as an action on any filter, including the junk mail filter rules.

Update: Peatey asks if this script is subject to Benford's Laaw.

Actually, the first few bytes of every message generally be identical in that every message will almost always start with "Return-Path: ".

But that shouldn't actually matter.

First, a little over 2K of data will be written to /dev/random every time a piece of mail is processed via the script. While the first few bytes are likely going to be identical, the rest of the data is pretty random save for that it is all ASCII and generally all printable data.

However, the data-- both quantity at once and exact time of arrival-- will arrive at fairly random intervals. In my case, whenever I hit shift-cmd-N or Mail decides to go check for new messages on the various servers.

This is because /dev/random generates a single random number stream that is used by all processes on the system using the Yarrow algorithm. The data written to /dev/random effectively perturbs that stream by smudging the internal state of the random number generator.

As such, both the time of the arrival of the data and the values themselves matter. Since the arrival time of the spam is fairly inconsistent-- bursty even-- that fact alone will contribute to the entropy of the random number generator fairly significantly.

Comment on this post [ so far] ... more like this: [Mac OS X, Security, Technology] ... topic exchange: [Mac OS X, Security, Technology]

RIP: Jef Raskin (1943-2005)

Jef Raskin passed away on February 26th, 2005.

Sad now.

Comment on this post [ so far] ... more like this: [Death, Life] ... topic exchange: [Death, Life]