[Slightly OT] New Spam Fighting Technique

John Rudd jrudd at UCSC.EDU
Fri May 7 21:10:36 IST 2004


It looks like some of my comments got line-wrapped, which could make
the script hard to run.  Here's one with the comments removed (and note
that the sendmail_args variable should NOT have a newline in it, that's
wrapped whitespace):

#!/usr/bin/perl

use Socket;

my $rin, $rout, $nfound, $port, $paddr, $addr, $remote, $pattern,
$delay;
my $delay_time = 35;
my $sendmail = "/usr/sbin/sendmail";
my $sendmail_args = "-bs -OPrivacyOptions=noetrn
-ODeliveryMode=queueonly -OQueueDirectory=/var/spool/mqueue.in";
my $sendmail_command = $sendmail . " " . $sendmail_args;

my @addrs = (
           "^10\.0\.1",
           "^127\.");

vec ($rin, fileno(STDIN), 1) = 1;

($port, $paddr) = sockaddr_in(getpeername(STDIN));
$addr = inet_ntoa($paddr);

$delay = 1;
foreach $pattern (@addrs) {
    if ($addr =~ "$pattern") {
       $delay = 0;
       break;
       }
    }

unless ($delay && ($nfound = select($rout = $rin, undef, undef,
$delay_time))) {
    exec $sendmail_command;
    }

-------------------------- MailScanner list ----------------------
To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/     and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html



More information about the MailScanner mailing list