source: trunk/dnsbl/import-cur.cgi@ 64

Last change on this file since 64 was 2, checked in by Kris Deugau, 15 years ago

/trunk/dnsbl

Import work to date

  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author Id
File size: 718 bytes
Line 
1#!/usr/bin/perl
2# import current zone data
3
4use strict;
5use warnings;
6
7use DNSBL;
8
9print "Content-type: text/plain\n\n";
10
11my $dnsbl = new DNSBL;
12$dnsbl->connect;
13
14open EXISTING, "<spamhosts.company.com";
15
16while (<EXISTING>) {
17 next if /^#/;
18 next if /^\s*$/;
19 next if /^\+\*\./;
20 if ($_ !~ /^\+(\d+)\.(\d+)\.(\d+)\.(\d+)\.spamhosts.company.com:127.0.0.(\d+):/) {
21 print;
22 next;
23 }
24 my $ip = "$4.$3.$2.$1"; my $bitfield = 0+$5;
25 next if $dnsbl->ipexists($ip);
26 if ($bitfield & 2) {
27 print "$ip\tlisted\t".
28 ($bitfield & 4 ? 'block' : '')."\t".
29 ($bitfield & 8 ? 'upstr' : '')."\t".
30 ($bitfield & 16 ? 'OOB' : '')."\n";
31 }
32 print "$ip\t**moron listing**\n" if $bitfield & 128;
33# last if $. > 180;
34}
Note: See TracBrowser for help on using the repository browser.