Article View: news.software.readers
Article #193844Re: I want to filter out replies to trolls.
From: Mike Yetto
Date: Sat, 23 Dec 2006 21:12
Date: Sat, 23 Dec 2006 21:12
255 lines
7380 bytes
7380 bytes
There I was, minding my own business, when
Mac Cool wrote...
> The only thing worse than trolls are the idiots who cannot stop
> themselves from replying. Sometimes otherwise intelligent
> posters cannot resist the bait.
>
You might miss some interesting Troll-baiting this way, which is why
I stopped using this perl script and nearly forgot about it.
> I want to killfile the troll (no problem). Next I want to
> automatically filter out any thread started by a troll and
> filter out any replies to a troll. Anyway to do the latter two
> with an XP compatible newsreader? Currently I use Xnews but will
> switch for a good, gui reader that will do this.
>
If you have perl installed on your system (and why not?) you can run
this before you open Xnews and it will round up all of the usual
suspects as well as replies to them. It uses the entire MID so that
it will only hit that particular thread, but you can run it each time
you start Xnews if you wish.
Should you find usable commonality in the MIDs go with that instead.
I don't remember where I got this script, nor do I remember what
changes I made to it, so will the author please speak up should the
occasion arise.
==== script ====
#!/usr/bin/perl -w
use strict;
use News::NNTPClient;
use File::Basename;
my ($debug, $ini_file, $server_name, $user_name, $password, $newsrc,
$old_score_file, $expire_in_days, $score_value, @bad_from,
$new_score_file, $backup_score_file, @score_file, $group, $c, $first,
$last, $rest, $last_read, $article, $message_id, $from, $bad_from,
@message_ids, $mt, $mday, $mon, $year, $found, $score_file, $mid);
my $already_printed = 0;
my ($basename, $path, $ftype) = fileparse($0, ".pl");
# 0 - print nothing
# 1 - print results going out
# 2 - print both input and output
$debug = 1;
if ( $#ARGV > -1 )
{
$ini_file = $ARGV[0];
}
else
{
$ini_file = $path . "killrefs.ini";
}
open(INI_FILE, $ini_file) or die "Can't open $ini_file";
chomp($server_name = <INI_FILE>);
chomp($user_name = <INI_FILE>);
chomp($password = <INI_FILE>);
chomp($newsrc = <INI_FILE>);
chomp($old_score_file = <INI_FILE>);
chomp($expire_in_days = <INI_FILE>);
chomp($score_value = <INI_FILE>);
while (<INI_FILE>)
{
chomp;
push @bad_from, $_;
}
$c = new News::NNTPClient($server_name);
$c->authinfo($user_name, $password) or die "Can't connect to
$server_name as $user_name";
#print "Server:\t $server_name\n";
#print $c->list('overview.fmt');
$new_score_file = $old_score_file . "_new";
$backup_score_file = $old_score_file . "_bak";
open(NEWSRC, $newsrc) or die "Can't open $newsrc";
open(OLD_SCORE_FILE, $old_score_file) or die "Can't open
$old_score_file";
@score_file = <OLD_SCORE_FILE>;
close OLD_SCORE_FILE;
while (<NEWSRC>)
{
next if ! /:/;
next if /:$/;
chomp;
( $group, $rest ) = split(':');
( $first, $rest ) = split('-', $rest);
( $last_read, $rest ) = split('/', $rest);
( $last_read, $rest ) = split(',', $last_read);
( $first, $last ) = ( $c->group($group) );
$debug > 1 && print "$group $first $last_read $last\n";
for $from ($c->xhdr("From", $last_read, $last))
{
$debug > 1 && print "$from\n";
for $bad_from (@bad_from)
{
if ( $from =~ /$bad_from/ )
{
( $article, $rest ) = split(' ', $from);
( $message_id ) = $c->xhdr("Message-ID", $article);
chomp $message_id;
$message_id =~ s/^.*<(.*)>$/$1/;
$debug > 1 && print $message_id, "\n";
push @message_ids, $message_id;
#it's been found, stop looking
last;
}
}
}
}
$debug && print "Done reading\n";
if ( $#message_ids > -1 )
{
open(NEW_SCORE_FILE, ">$new_score_file") or die "Can't open
$new_score_file";
$mt = time() + $expire_in_days * 86400;
# (undef,undef,undef,$mday,$mon,$year,undef,undef) = gmtime($mt);
(undef,undef,undef,$mday,$mon,$year,undef,undef) =
localtime($mt);
$year += 1900;
$mon += 1;
$found = 0;
for $score_file (@score_file)
{
print NEW_SCORE_FILE $score_file;
next if $found;
next if ! ( $score_file =~ /^\[\.\]/ );
$found = 1;
print_message_ids();
}
if ( not $found )
{
print NEW_SCORE_FILE "\n\[\.\]\n";
print_message_ids();
}
close NEW_SCORE_FILE;
rename $old_score_file, $backup_score_file or die "Can't rename
$old_score_file to $backup_score_file";
rename $new_score_file, $old_score_file or die "Can't rename
$new_score_file to $old_score_file";
}
else
{
$debug && print "No message ids this time!\n";
}
sub print_message_ids
{
for $mid (@message_ids)
{
$mid =~ s/\$/\\\$/g;
$mid =~ s/\./\\./g;
$mid =~ s/\-/\\-/g;
$debug && print $mid, "!\n";
if ( not $already_printed) {
print NEW_SCORE_FILE "\n % generated by KillRefs.pl\n
Score:: $score_value\n Expires: $mon/$mday/$year\n";
$already_printed = 1;
}
print NEW_SCORE_FILE " References: <$mid>\n";
}
}
==== end script ====
It uses this data file.
==== data file ====
<server address>
<userid>
<password>
<full path to .newsrc file>
<full path to score.ini>
10 <days till expiration>
-9999 <score to apply>
Leythos
rmholt
Casner
Ragnar Suomi
java@evij.com
jkb@yeahright.com
none@no.way
Bob McConnell
rmcconne@NOSPAM.lightlink.com
Hal.Turner@HalTurnerShow.com
Alan Connor
Georg Ten Brouck
hiawatha@efn.org
galen thurber
paul kneisel
rose marie holt
Peter H.M. Brooks
Dusty Dahmer
Ed Conrad
edconrad@verizon.net
Danny@DD.net
==== end data file ====
Mike "baiting trols can be fun" Yetto
--
"There is danger from all men. The only maxim of a free
government ought to be to trust no man living with power to
endanger the public liberty."
- John Adams
Technical Details
Message-ID:
<Xns98A2A4DDDD8FFuniquelyme@26-96-177-194.serverdedicati.seflow.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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!80.239.136.21.MISMATCH!newspeer2.de.telia.net!newspeer3.de.telia.net!de.telia.net!aioe.org!not-for-mailReferences:
<Xns98A1EA34216F6MacCool@130.133.1.4>Show Full Headers
Complete Article Headers
Message-ID: <Xns98A2A4DDDD8FFuniquelyme@26-96-177-194.serverdedicati.seflow.net>
Subject: Re: I want to filter out replies to trolls.
Date: Sat, 23 Dec 2006 16:12:25 -0500
From: Mike Yetto <mike.yetto@nycap.invalid>
References: <Xns98A1EA34216F6MacCool@130.133.1.4>
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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!80.239.136.21.MISMATCH!newspeer2.de.telia.net!newspeer3.de.telia.net!de.telia.net!aioe.org!not-for-mail
Newsgroups: news.software.readers
Organization: None at all
Lines: 255
NNTP-Posting-Host: TYmfluFq/jQO5TFipGua4A.user.aioe.org
X-Complaints-To: abuse@aioe.org
X-No-Bananas: Yes
X-Face: |r>RlUD1uaj^+}lH:1x}DRPEVBE10?q; 6kK-z/g54Sm5un@|e'd;
MBx>,mw4U_J{:@+2{^77p/rY\g%7gE$V,}ZT?e>5tttHXeodYk\'q1Jv5R1Y@297IYtjygnnPfR4'8>3c:<<bJtx#[<5rd-UP_F?\?j>[5:.5ViK#8o+?^D{hi=c0]5Z=6d,|`tq_:(C1(1`@FbN)Cj(]D*}z[o"<~cu!|Is\2(e#[-Fjeg_M7PS/@LG
User-Agent: Xnews/2006.08.24