Spamlib.pl

Spamlib.pl is a simple set of functions that allow you to check if any of a list of popular email address extraction robots are calling your page. If you have pages which are generated by Perl scripts, you can use spamlib.pl to give spammers a list of bogus email addresses instead of the page that would normally be returned by your script, and spamlib.pl has a routine to notify you that you choked a spammer.

Spamlib.pl can be modified to run as a Perl script for use as a Server Side Include executable to hide your email address from spammers, or to generate pages of bogus email addresses to keep spammers busy with false addresses.

Many of my pages are Perl scripts that return an html page. With the following call at the top of my script I can check to see if a spammer is trying to scavenge my email address without adding a bunch of functions to all my perl scripts:

#!/usr/bin/perl
# Start your script
# use spam package
push (@INC,"/home/userdir/public_html/"); # spamlib.pl is in public_html
require ("spamlib.pl");
&spamCheck();
# end spam check
# On with the script.

That's it! spamCheck() is a function that loops through a list of extraction robot names and compares them to the environmental USER_AGENT variable. If any of them match, spamCheck calls a routine to return a list of bogus email addresses to the spammer, and then another routine to look up the hostname of the spammer. It then sends you mail telling you the routine was invoked. You can easily modify spamlib.pl and the spamCheck routine to work the way you want it to.

To use spamlib.pl simply place it in a location available to your perl script, push the name of that directory onto the list of directories to look for things, import it into your script with a require statment, and then call &spamCheck().


Spamram.pl

Spamram.pl is a script for use with Server Side Includes (SSI) that you can use to protect your email address from spam harvesting robots. It is basically spamlib.pl that has been modified to run as a standalone script. It can be called as an SSI in various ways.

<!--#exec cmd="spamram.pl"-->
This call returns the email address you set in spamram.pl with an html mail tag (i.e. you@youremail.com). When you write your pages, simply include this line instead of your email tag.

If you call spamram.pl with an email address as an argument it will use that email address instead. For instance:

<!--#exec cmd="spamram.pl me@myotheraddress.net"-->
Instead of using the default address within the script, it uses the address you provide. This call returns me@myotheraddress.net

<!--#exec cmd="spamram.pl me@myotheraddress.net address"-->
returns only the email address, and not the html markup.
<!--#exec cmd="spamram.pl me@myotheraddress.net mailme"-->
returns the provided email address marked up as an html mailto tag with the "mailme" as the tag label.
<!--#exec cmd="spamram.pl spamcheck"-->
returns nothing. Simply checks to see if an email harvesting robot is calling your page, and if so, it includes a bunch of fake email adresses, otherwise returns nothing.


Chris Seidel