Difference between revisions of "Spam"

From C4 Wiki
Jump to: navigation, search
Line 1: Line 1:
[[Spam/IP Blocks]]
+
Spam
  
= IP Blocks =
+
* [[Spam/IP Blocks]]
IP Blocks haben sich als einigermassen effektiv gegen Spammer erwiesen.
+
* [[Special:Ipblocklist]]
 
 
Folgendes Skript erleichtert die Einrichtung von IP Range Blocks.
 
#!/usr/bin/perl -w
 
# description: generate mediawiki ipblock entries for ipranges
 
# usage: copy ips of all spammers from  'recent changes' (check entries with diff)
 
use POSIX qw(strftime);
 
# get netranges from whois output
 
while (<>)  {
 
    chomp;
 
    if (m/netname:/) {
 
        my $netname = $_;
 
        $netname =~ s/netname:\s*//;
 
        $names{$old} = $netname;
 
    }
 
    next unless $_ =~ m/inetnum:/;
 
    s/inetnum:\s*//;
 
    s/ //g;
 
    $seen{$_} = 1;
 
    $old = $_;
 
}
 
# let ipcalc calculate the range
 
foreach my $line (keys %seen) {
 
    my $out = `ipcalc $line`;
 
    my @ranges;
 
    foreach (split(/\n/,$out)) {
 
        next if m/deaggregate/;
 
        chomp;
 
        push @ranges, $_;
 
    }
 
    foreach my $r (@ranges) {
 
        print "http://wiki.koeln.ccc.de/index.php?title=Special:Blockip&ip=$r\n";
 
        my $start = strftime "%Y%m%d%H%M%S", localtime;
 
        print "INSERT INTO ipblocks VALUES ('','$r', 0, 2, 'SPAMMER $names{$line}','$start',0,''); \n";
 
    }
 
}
 
 
 
 
 
Benutzen:
 
whois 221.194.75.8 | perl ~/whois2iprange.pl
 
  
 
[[Category:Infos]]
 
[[Category:Infos]]

Revision as of 10:55, 20 October 2005