🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #34299

Tool to cancel local spam

#34299
From: Jean-Francois Stenuit
Date: Sun, 03 Jan 1999 00:00
68 lines
3244 bytes
Following the SPAM flooding of the recent days, I quickly wrote this
little perl script. Given three arguments, it will cancel locally all SPAM
corresponding to the arguments.

First argument is the newsgroup you want to clean up.
Second argument is the name of the news server used to issue the SPAM
 (it require a bit of practice to guess it correctly. You have to
  check the Path: header of all received SPAM and see what is the
  rightmost common machine).
Third argument is the name of a polluting newsgroup
 (it seem that a lot of spammer adds a newsgroup when sending their junk,
  nowadays, it is most often alt.gothic).

Example :
canceler.pl news.software.nntp forums.powersoft.com alt.gothic
 ... will cancel all articles posted in news.software.nntp that has passed
 through forums.powersoft.com OR that are crossposted to alt.gothic

The script :

#!/usr/local/bin/perl

$newsgroup=shift(@ARGV);
$badguy=shift(@ARGV);
$poisongroup=shift(@ARGV);

$newsgroup=~s/\./\//g;

$dir="/usr/local/news/spool/articles/".$newsgroup;

opendir (D,$dir) or die "Cannot read directory content $dir";
@files=readdir(D);
closedir(D);

foreach $file (@files) {
        $messageid='';
        $tocancel=0;
        print "Scanning $file\n";
        open(F,"<$dir/$file") or die "Cannot read $file : $!";
        while(<F>) {
                chomp;
                break if (/^$/);
                $tocancel=1 if (/^Path: .*$badguy/);
                $tocancel=1 if (/^Newsgroups: .*$poisongroup/);
                if (/^Message-ID: (.*)/) {
                        $messageid=$1;
                }
        }
        if (($tocancel) && ($messageid ne '')) {
                print "Cancel $messageid\n";
                print `/usr/local/news/bin/ctlinnd cancel \'$messageid\'`;
        }
}


--
 Opinions expressed above are mine, they have not to be taken as a
 skynet official position.
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/Jean-Francois "Jef" Stenuit | BELGACOM-Skynet NV/SA | Solaris 2.x,  \
\Network operations manager  | 124, Rue Col. Bourg   | Linux, NT,    /
/Phone (32)(2) 706-1311      | B-1140 Brussels       | Cisco         \
\Fax   (32)(2) 726-9823      | Belgium               | expert ...    /
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


Technical Details
Message-ID: <Pine.LNX.3.96.990103172557.16403B-100000@lazy.techos.skynet.be>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.net-abuse.misc.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <Pine.LNX.3.96.990103172557.16403B-100000@lazy.techos.skynet.be>
Subject: Tool to cancel local spam
Date: Sun, 03 Jan 1999 00:00:00 +0000
From: Jean-Francois Stenuit <newsadmin@somewhere.around.the.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.net-abuse.misc.mbox.zip!not-for-mail
X-Deja-AN: 428331499
X-Sender: jef@lazy.techos.skynet.be
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Complaints-To: abuse@skynet.be
X-Trace: news1.skynet.be 915381266 7951 195.238.1.72 (3 Jan 1999 16:34:26 GMT)
Organization: Belgacom Skynet SA/NV
Mime-Version: 1.0
NNTP-Posting-Date: 3 Jan 1999 16:34:26 GMT
Newsgroups: news.software.nntp,news.admin.net-abuse.misc