Article View: news.software.readers
Article #240045Re: [slrn] Threading killfile application?
From: Ignoramus8009
Date: Tue, 09 Mar 2010 03:02
Date: Tue, 09 Mar 2010 03:02
115 lines
4718 bytes
4718 bytes
On 2010-03-08, Whiskers <catwheezel@operamail.com> wrote:
>> Here's my own solution:
>>
>> Write a perl script that would
>>
>> a) Make a list of recent message-ids from "evil" people, based on
>> xover information
>> b) Generate a scorefile that bans anything in References: that
>> includes those message-ids
>> c) Include that scorefile from the main scorefile
>> d) Run this perl script automatically often.
>>
>> i
>
> I'm not stopping you :))
>
#!/usr/bin/perl
#
# Script to killfile trolls and all followups to their posts
#
# Copyright (C) Igor Chudov, 2010
# Released under GNU Public License v3
#
my $usage = "USAGE: $0 --server news.server.com --user username --password pAssWorD [--style (slrn|ids)]";
use strict;
use warnings;
use Getopt::Long;
use News::NNTPClient;
my $server = undef;
my $username = undef;
my $password = undef;
my $trollfile = "$ENV{HOME}/configs/general/usenet-trolls.txt";
my $style = 'slrn';
my $newsgroups = 'rec.crafts.metalworking,alt.machines.cnc';
my $max = 1_000;
GetOptions(
"server=s" => \$server,
"username=s" => \$username,
"password=s" => \$password,
"trollfile=s" => \$trollfile,
"style=s" => \$style,
"max=i" => \$max,
"newsgroups=s" => \$newsgroups,
);
die $usage unless $server && $username && $password;
die $usage unless { slrn => 1, ids => 1 }->{$style};
die "Cannot find file $trollfile" unless -f $trollfile;
my $nntp = new News::NNTPClient( $server )
|| die "Cannot connect to server";
$nntp->authinfo( $username, $password ) || die "Cannot logon to $server";
my $trolls = [];
open( TROLLS, $trollfile ) || die "Cannot open $trollfile: $!.\n";
while( <TROLLS> ) {
next if /^\s*\#/;
next if /^\s*$/;
chomp;
s/\s*\#.*$//;
push @$trolls, $_;
}
close( TROLLS );
my @newsgroups = split( /,/, $newsgroups );
foreach my $ng (@newsgroups) {
my ($start, $end) = $nntp->group( $ng );
$start = $end-$max if $end-$max > $start;
next unless $end > $start;
print STDERR "Analyzing $ng: $start=>$end...\n";
my @fields = qw(numb subj from date mesg refr char line xref);
foreach my $xover ( $nntp->xover( $start, $end ) ) {
my %fields = ();
@fields{@fields} = split /\t/, $xover;
#print "From = $fields{from}, mesg = $fields{mesg}.\n";
my $from = $fields{from};
my $mesg = $fields{mesg};
my $matches = undef;
foreach my $troll (@$trolls) {
my $m = quotemeta( $troll );
if ( $from =~ /$m/ ) {
print STDERR "Message from troll $troll ($from) => $mesg\n";
$matches = 1;
last;
}
}
if ( $matches ) {
$mesg =~ s/^<//;
$mesg =~ s/>$//;
if ( $style eq 'slrn' ) {
print "
[*]
Score: -666
References: $mesg
";
}
}
}
}
exit 0;
Technical Details
Message-ID:
<3JOdnUPTF8v9JwjWnZ2dnUVZ_tqdnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<DuGdnS81o5y33w7WnZ2dnUVZ_i2dnZ2d@giganews.com> <slrnhp7dop.lqk.catwheezel@ID-107770.user.individual.net> <OJqdnajzrt83-AjWnZ2dnUVZ_tidnZ2d@giganews.com> <slrnhpasar.f0r.catwheezel@ID-107770.user.individual.net>Show Full Headers
Complete Article Headers
Message-ID: <3JOdnUPTF8v9JwjWnZ2dnUVZ_tqdnZ2d@giganews.com> Subject: Re: [slrn] Threading killfile application? Date: Mon, 08 Mar 2010 21:02:56 -0600 From: Ignoramus8009 <ignoramus8009@NOSPAM.8009.invalid> References: <DuGdnS81o5y33w7WnZ2dnUVZ_i2dnZ2d@giganews.com> <slrnhp7dop.lqk.catwheezel@ID-107770.user.individual.net> <OJqdnajzrt83-AjWnZ2dnUVZ_tidnZ2d@giganews.com> <slrnhpasar.f0r.catwheezel@ID-107770.user.individual.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 08 Mar 2010 21:02:55 -0600 Newsgroups: news.software.readers User-Agent: slrn/pre1.0.0-11 (Linux) Lines: 115 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-x2jFh/+KHvR01wIFudu06ac3HoisEbIN9tHLLAfFQMmI2eJqQYy4UNz2FuhLLxVLAKxS6LnPpAzZDYI!f7dI7sVNjauag2G4GUq/Evb4PFY+WRJ4msj98vyG25ZZ8cZWA60WPxMt1OBMZj+sTIs5Uqtrv/4T X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4141