« SSL cipher suite choice | Main | ATM Security & NETs Security »

Automating SpamCop Reporting

Introduction

' SpamCop is a service for reporting spam. SpamCop determines the origin of unwanted email and reports it to the relevant Internet service providers. By reporting spam, you have a positive impact on the problem. Reporting unsolicited email also helps feed spam filtering systems, including, but not limited to, the SpamCop blacklist used in SpamAssassin as a DNSBL.

Unfortunately, this is an ongoing battle. Spammers adapt quickly and persistently. Report spam and help SpamCop turn the tide. SpamCop makes this otherwise slow and technical task quick and easy.

The SpamCop reporting service is free. '

The easiest way to use SpamCop is to sign up with them. The best is to support them is through donations or to sign up for their services

Sending Your Spam to SpamCop
Once you have your account set up, I recommend that you forward your complete spam message using attachments, to your personal spam reporting email address instead of going through the pain of submitting them via the web based form. Mine looks like this (scrubbed): submit.hXfjblahblablahB@spam.spamcop.net.

Note: make sure you forward to your personal spam reporting address only genuine spam!

I use the excellent Thunderbird with the Okopipi plugin.

' Okopipi plugin for thunderbird reports spam to SpamCop, to the FTC, FDA, SEC, ACMA and/or Knujon.com. It also allows you to put in your own custom addresses to report spam to such as your ISP or corporate abuse address.

This will properly forward any message in your current folder marked as junk to the places you configure in your preferences. All you will have to do is hit send. '

After you have installed Okopipi, configure it to forward spam to your personal SpamCop reporting address. Customize your top -window thunderbird toolbar: right click on toolbar ->  Customize. Add the Okopipi Report button to your toolbar.

All you have to do now when you receive email, is to carefully mark as Junk spam messages and to mark as Not Junk these emails that were incorrectly marked as junk by Thunderbird. Then hit the Okopipi Report button, and click send. SpamCop will receive all your spam, ready to report them for you.

Getting SpamCop to Report the Spam Messages for you
A this point, you may have a few dozens email messages in your SpamCop queue. The main problem right now is that SpamCop requires you to report your spam messages one by one. To report a spam and remove it from the queue, you have to perform 2 clicks. It's hardly usable: if you just forwarded 100 messages that would make 200 clicks...

I seriously hate to click, so I spent half an hour writing a simple Perl script that would process the SpamCop reporting web-based forms, and click "submit" on my behalf. It basically does the monkey job of clicking through all the web based forms for you, all from one command line.

The Script
You can download the script here. Save it somewhere. And don't forget to edit it to reflect your SpamCop settings.

Edit the following stanza to match your settings:

##########################################
##
## EDIT HERE
##
##########################################
my $username = 'william.gates@msn.com';
my $password = 'My Password Rocks';
##########################################

Further down, you may want to set your HTTP proxy address if you are using any. Uncomment the following line, and set your proxy:

# if you need proxy, uncomment that.
# $browser->proxy(['http', 'ftp'],
'http://username:password@127.0.0.1:8080/');

Don't forget to modify the ISP settings, lower down in the script. I could have made a configurable array at the beginning of the file, but I was seriously lazy to do it..

You are almost ready to go. Now you'll have some Perl modules dependencies to solve first.

Necessary Perl Modules
use Tie::InsertOrderHash;
use LWP;
use HTTP::Cookies;
use HTML::TreeBuilder;
use MIME::Base64;

Some of these modules may already be installed on your Linux or *BSD distribution. Most of them will be available as a distribution package in .rpm, .deb, .pkg, etc... or you can download them manually and install. Additionally you may want to use the CPAN Shell to download the module and any dependency.

Warning
Please use this script only to report genuine spam. If you abuse this script, SpamCop will respond by changing its form to include Captchas which will disturb real users even more and that will totally spoil the purpose of this script.

Enjoy. If you have any problem with that script, don't hesitate to comment.
Download the script here.

Update 2006-11-17
Apparently, there is a similar script available on sourceforge called SpamCup. I haven't checked yet to see how the two scripts compare though.

June 2007

Sun Mon Tue Wed Thu Fri Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Professional IT Security Services:
FMA-RMS logo

Locations of visitors to this page