🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
9 messages
9 total messages Started by Anonyma Mon, 19 Feb 2007 13:55
here is the famous trollwatch script, donated to the usenet populous!
#195753
Author: Anonyma
Date: Mon, 19 Feb 2007 13:55
194 lines
6429 bytes
#!/usr/bin/perl
require 5;
$VERSION = '1.0';
use File::Slurp;
use warnings;
use Getopt::Std;
use List::Util ('shuffle');
use News::Article;
use strict 'refs';

my(%option, $inputFilename, $outputFilename, @addBody, $code);
my $ctr = 0;
my(@dropGroups) = ();
my(@followups) = ();

# generate troll alerts
# example:
# $ grep -r -l '^From: Some Idiot' /var/spool/news/alt/what/ever |xargs trollwatch

# By default this script adds Followup-To: alt.dev.null,
# X-No-Archive: Yes, and a X-Code header to keep it from replying
# to its own messages. It also copies the troll's From so that
# people who killfile him won't see these alerts.

# This script just generates messages, it's up to you how you get
# them onto usenet.  Warning, if you post a lot of these so you
# can be traced, you'll probably get TOSsed!

# -G alt.foo,alt.bar
#    drop some Newsgroups
# -N 
#    do not FU alt.dev.null
# -a 
#    do not set X-No-Archive: Yes
# -b FILE
#    use text from FILE instead of default data
# -c 
#    suppress X-Code: random header
# -d DIRECTORY
#    put output file here instead of pwd
# -f 'Some Name foo@bar'
#    use this From header instead of copying
#    from the original messages
# -u alt.foo,alt.bar
#    add FUs
# -L FILE
#    ignore files not newer than FILE

# This script is hereby donated to the PUBLIC DOMAIN.

getopts 'd:af:b:u:G:NcL:', \%option;

my $maxAge = $option{L} ? (-M $option{L}) : 0;
my $outputDirectory = $option{'d'} || '.';
if ($option{'G'}) {
    @dropGroups = split(/,/, $option{'G'}, 0);
}

push @followups, 'alt.dev.null' unless $option{'N'};
push @followups, split(/,/, $option{'u'}, 0) if $option{'u'};

if ($option{'b'}) {
    @addBody = read_file($option{'b'});
}
else {
    @addBody = <DATA>;
}

foreach $inputFilename (@ARGV) {
    if (($option{L}) && (-M $inputFilename >= $maxAge)) {
        print "$inputFilename  ignored (too old)\n";
    }
    else {
	my $input = 'News::Article'->new($inputFilename);
	if ($input->header('X-Code')) {
	    print "$inputFilename  ignored (X-Code)\n";
	}
	else {
	    my $output = 'News::Article'->new;
	    my $from = $option{'f'} || $input->header('From');
	    $output->set_headers('Subject', reSubject($input), 
				 'From', $from, 
				 'References', reRefs($input));
	    $output->set_headers('X-No-Archive', 'Yes') unless $option{'a'};
	    unless ($option{'c'}) {
		$code = `mcookie`;
		chomp $code;
		$output->set_headers('X-Code', $code);
	    }
	    $output->set_body(reBody($input));
	    my(@groupings) = reGroup($input);
	    my $groups;
	    while (@groupings) {
		$outputFilename = getFilename($outputDirectory, $inputFilename);
		$groups = shift @groupings;
		$output->set_headers('Newsgroups', $groups);
		$output->set_headers('Followup-To', fu($groups)) if @followups > 0;
		open OUTFILE, ">$outputFilename";
		$output->write(\*OUTFILE);
		close OUTFILE;
		print "$inputFilename  -->  $outputFilename\n";
	    }
	}
    }
}

sub reSubject {
    my $subject = $_[0]->header('Subject');
    $subject = 'Re: ' . $subject unless $subject =~ /\s*(\[.*\])?\s*Re:/i;
    return $subject;
}

sub reRefs {
    my(@refs) = $_[0]->header('Message-ID');
    my(@oldRefs) = split(/\s+/, $_[0]->header('References') || '', 0);
    unshift @refs, pop @oldRefs if @oldRefs;
    unshift @refs, shift @oldRefs if @oldRefs;
    return join(' ', @refs);
}

sub getFilename {
    my $orig = $_[1];
    $orig =~ s[^.*/][];
    my $fn;
    do {
        $fn = $_[0] . '/' . $orig . '-' . $$ . $ctr++ . '.output'
    } while -f $fn;
    return $fn;
}

sub reGroup {
    my(@groups) = shuffle(split(/,/, $_[0]->header('Newsgroups'), 0));
    if ($option{'G'}) {
        @groups = dropGroups(@groups);
    }
    my(@output) = ();
    while (@groups > 3) {
        push @output, join(',', @groups[0, 1, 2]);
        shift @groups;
        shift @groups;
        shift @groups;
    }
    push @output, join(',', @groups);
    return @output;
}

sub dropGroups {
    my(%groups) = map({$_, 1;} @_);
    foreach my $item (@dropGroups) {
        delete $groups{$item};
    }
    return keys %groups;
}

sub fu {
    my(@groups) = split(/,/, $_[0], 0);
    unshift @groups, @followups;
    if (@groups > 3) {
        @groups = @groups[0, 1, 2];
    }
    return join(',', shuffle(@groups));
}

sub reBody {
    my(@old) = $_[0]->body;
    my $from = $_[0]->header('From');
    my(@new) = map({"> $_";} grep({not $_ =~ /:\s*$/ if not $_ =~ /^\s*>/ and not $_ =~ /^\s*$/;} @old));
    while (@new > 4) {
        pop @new;
    }
    unshift @new, "$from wrote:", '';
    push @new, '', @addBody;
    return @new;
}

__DATA__
                    /|  /|      _____________________
                    ||__||     |                     |
                   /   O O\__  |    PLEASE DO NOT    |
                  /          \ |   FEED THE TROLLS   |
                 /      \     \|_____________________|
                /   _    \     \      ||
               /    |\____\     \     ||
              /     | | | |\____/     ||
             /       \|_|_|/   |     _||
            /  /  \            |____| ||
           /   |   |           |      --|
           |   |   |           |____  --|
    * _    |  |_|_|_|          |     \-/
*-- _--\ _ \                  |      ||
   /  _     \\        |        /      `
*  /   \_ /- |       |       |
   *      ___ C_c_c_C/ \C_c_c_c____________ 
Re: here is the famous trollwatch script, donated to the usenet populous!
#195763
Author: Peter J Ross
Date: Mon, 19 Feb 2007 16:13
22 lines
1953 bytes
On Mon, 19 Feb 2007 08:55:36 -0500 (EST), Anonyma
<anon-bounces@deuxpi.ca> wrote in news.software.readers:

> # By default this script adds Followup-To: alt.dev.null,
> # X-No-Archive: Yes, and a X-Code header to keep it from replying
> # to its own messages. It also copies the troll's From so that
> # people who killfile him won't see these alerts.

Is forgery better than trolling?

> # This script just generates messages, it's up to you how you get
> # them onto usenet.  Warning, if you post a lot of these so you
> # can be traced, you'll probably get TOSsed!

Warning to newbies: *one* such forged post will be enough to cause
you problems with your friendly neighbourhood news admin.

Second warning to newbies: don't run code from anonymous sources
unless you know exactly what every line does.

-- 
PJR :-)
Re: here is the famous trollwatch script, donated to the usenet populous!
#195775
Author: Frank Slootweg
Date: Mon, 19 Feb 2007 21:53
8 lines
1544 bytes
> # This script is hereby donated to the PUBLIC DOMAIN.

  This might not be *possible* in its jurisdiction [1].

[1] For example it's not possible in my jurisdiction (The Netherlands).
I.e. one *cannot* relinguish one's copyright. So the software may be
'free', 'open', <whatever>, but it's *not* in "the public domain". AFAIK
most other European countries have similar copyright laws.
Re: here is the famous trollwatch script, donated to the usenet populous!
#195776
Author: I R A Darth Aggie
Date: Mon, 19 Feb 2007 22:04
22 lines
2069 bytes
On 19 Feb 2007 21:53:51 GMT,
Frank Slootweg <this@ddress.is.invalid>, in
<45da1c6e$0$274$dbd49001@news.wanadoo.nl> wrote:
>+ > # This script is hereby donated to the PUBLIC DOMAIN.
>+ 
>+    This might not be *possible* in its jurisdiction [1].
>+ 
>+  [1] For example it's not possible in my jurisdiction (The Netherlands).
>+  I.e. one *cannot* relinguish one's copyright. So the software may be
>+  'free', 'open', <whatever>, but it's *not* in "the public domain". AFAIK
>+  most other European countries have similar copyright laws.

Really?

I find that...astounding. What happens to expired copyrights, or do
you have *gasp* never-ending copyrights?

-- 
Consulting Minister for Consultants, DNRC
I can please only one person per day. Today is not your day. Tomorrow
isn't looking good, either.
I am BOFH. Resistance is futile. Your network will be assimilated.
Re: here is the famous trollwatch script, donated to the usenet populous!
#195778
Author: gregor herrmann
Date: Mon, 19 Feb 2007 22:34
32 lines
2684 bytes
On 19 Feb 2007 22:04:01 GMT, I R A Darth Aggie wrote:

>>+  [1] For example it's not possible in my jurisdiction (The Netherlands).
>>+  I.e. one *cannot* relinguish one's copyright. So the software may be
>>+  'free', 'open', <whatever>, but it's *not* in "the public domain". AFAIK
>>+  most other European countries have similar copyright laws.
> Really?

Yes.

> I find that...astounding. What happens to expired copyrights, or do
> you have *gasp* never-ending copyrights?

There is no copyright.
Astounding too, isn't it? :-)

Continental European "copyright" is built on a "droit d'auteur" (right
of the author) -- which cannot be given away -- plus licenses for the
use of works.

http://en.wikipedia.org/wiki/Copyright#Europe explains the situation
in some European countries.
http://en.wikipedia.org/wiki/Author%27s_rights explains the "droit
d'auteur" approach.


gregor
-- 
 .''`.   http://info.comodo.priv.at/ | gpg key ID: 0x00F3CFE4
 : :' :  debian: the universal operating system - http://www.debian.org/
 `. `'   member of https://www.vibe.at/ | how to reply: http://got.to/quote/
   `-    NP: Don McLean: Hit Parade Of Love
Re: here is the famous trollwatch script, donated to the usenet populous!
#195779
Author: Peter J Ross
Date: Mon, 19 Feb 2007 22:39
26 lines
2121 bytes
On 19 Feb 2007 22:04:01 GMT, I R A Darth Aggie
<hfrarg@nttvr2x3.pbgfr.arg> wrote in news.software.readers:

> On 19 Feb 2007 21:53:51 GMT,
> Frank Slootweg <this@ddress.is.invalid>, in
> <45da1c6e$0$274$dbd49001@news.wanadoo.nl> wrote:
>>+ > # This script is hereby donated to the PUBLIC DOMAIN.
>>+ 
>>+    This might not be *possible* in its jurisdiction [1].
>>+ 
>>+  [1] For example it's not possible in my jurisdiction (The Netherlands).
>>+  I.e. one *cannot* relinguish one's copyright. So the software may be
>>+  'free', 'open', <whatever>, but it's *not* in "the public domain". AFAIK
>>+  most other European countries have similar copyright laws.
>
> Really?
>
> I find that...astounding. What happens to expired copyrights, or do
> you have *gasp* never-ending copyrights?

Is there a Usenet rule that states "anonymous kooks sometimes make
sense"? I think not.


-- 
PJR :-)
Re: here is the famous trollwatch script, donated to the usenet populous!
#195780
Author: Frank Slootweg
Date: Mon, 19 Feb 2007 23:08
27 lines
2290 bytes
I R A Darth Aggie <hfrarg@nttvr2x3.pbgfr.arg> wrote:
> On 19 Feb 2007 21:53:51 GMT,
> Frank Slootweg <this@ddress.is.invalid>, in
> <45da1c6e$0$274$dbd49001@news.wanadoo.nl> wrote:
> >+ > # This script is hereby donated to the PUBLIC DOMAIN.
> >+ 
> >+    This might not be *possible* in its jurisdiction [1].
> >+ 
> >+  [1] For example it's not possible in my jurisdiction (The Netherlands).
> >+  I.e. one *cannot* relinguish one's copyright. So the software may be
> >+  'free', 'open', <whatever>, but it's *not* in "the public domain". AFAIK
> >+  most other European countries have similar copyright laws.
> 
> Really?
> 
> I find that...astounding. What happens to expired copyrights, or do
> you have *gasp* never-ending copyrights?

  Note that I said "one *cannot* relinguish [sic] one's copyright"! Note
the "one"'s! :-)

  BTW, AFAIK you have similar 'never-ending' copyrights. (But I don't
know if you can relinquish your copyright or not. Note "relinquish", not
"transfer".)

  For details, see for example 
<http://en.wikipedia.org/wiki/Copyright#How_long_copyright_lasts>.
Re: here is the famous trollwatch script, donated to the usenet populous!
#195791
Author: I R A Darth Aggie
Date: Tue, 20 Feb 2007 19:22
25 lines
2398 bytes
On 19 Feb 2007 23:08:53 GMT,
Frank Slootweg <this@ddress.is.invalid>, in
<45da2e05$0$277$dbd49001@news.wanadoo.nl> wrote:

>+    BTW, AFAIK you have similar 'never-ending' copyrights.

de jure, no so. de facto? given the numerous extensions, it would
appear that copyrights from the mid-1920's will expire some time
*after* the sun has gone thru a nova phase, and as been reduced to the
size of a brick.

>+ (But I don't know if you can relinquish your copyright or not. Note
>+ "relinquish", not "transfer".)

That's what the "public domain" is all about. Thus things like the
King James' Bible can be (re)printed at will, as they've fallen into
the public domain because the copyrights have expired. Works that
are still subject to copyright can be assigned into the public domain
- a sort of transfer.

-- 
Consulting Minister for Consultants, DNRC
I can please only one person per day. Today is not your day. Tomorrow
isn't looking good, either.
I am BOFH. Resistance is futile. Your network will be assimilated.
Re: here is the famous trollwatch script, donated to the usenet populous!
#195794
Author: Frank Slootweg
Date: Tue, 20 Feb 2007 20:41
48 lines
3600 bytes
I R A Darth Aggie <hfrarg@nttvr2x3.pbgfr.arg> wrote:
> On 19 Feb 2007 23:08:53 GMT,
> Frank Slootweg <this@ddress.is.invalid>, in
> <45da2e05$0$277$dbd49001@news.wanadoo.nl> wrote:
> 
> >+    BTW, AFAIK you have similar 'never-ending' copyrights.
> 
> de jure, no so. de facto? given the numerous extensions, it would
> appear that copyrights from the mid-1920's will expire some time
> *after* the sun has gone thru a nova phase, and as been reduced to the
> size of a brick.

  I was obviously talking about copyright on *current* stuff, i.e. the
OP. AFAIK, that's life + 50 or 70 years in the US (see the earlier
references).

> >+ (But I don't know if you can relinquish your copyright or not. Note
> >+ "relinquish", not "transfer".)
> 
> That's what the "public domain" is all about.

  Note quite, at least not worldwide. 

> Thus things like the King James' Bible can be (re)printed at will, as
> they've fallen into the public domain because the copyrights have
> expired.

  That, expiration, is worldwide, albeit with different (non) expiration
periods/rules.

> Works that are still subject to copyright can be assigned into the
> public domain - a sort of transfer.

  That, assigned into the public domain, *isn't* worldwide. As I
mentioned, and Gregor explained in more detail, in most European
countries, the copyright (author's rights) *cannot* be given away, i.e.
"give away" (my term "relinquish") != "transfer". A *transfer* is
possible, but you can't transfer something into the public domain. You
can transfer the copy/author's right only to another person, company,
etc., but the public domain isn't a person/company/etc.. (Basically you
need to be able to draw up a contract on the transfer and you can't get
"the public domain" to sign/draw_up a contract.)

  So as much as it breaks my heart and I *want* to get rid of them, I
can't assign my (copy/author's) rights on the contents of this posting
into the public domain. They will be mine till the day I die and then
some. OTOH, if you want, I can *sell* my 's rights to you, at a very
reasonable price, honest!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads