#!/usr/bin/perl # import current zone data use strict; use warnings; use DNSBL; print "Content-type: text/plain\n\n"; my $dnsbl = new DNSBL; $dnsbl->connect; open EXISTING, ") { next if /^#/; next if /^\s*$/; next if /^\+\*\./; if ($_ !~ /^\+(\d+)\.(\d+)\.(\d+)\.(\d+)\.spamhosts.company.com:127.0.0.(\d+):/) { print; next; } my $ip = "$4.$3.$2.$1"; my $bitfield = 0+$5; next if $dnsbl->ipexists($ip); if ($bitfield & 2) { print "$ip\tlisted\t". ($bitfield & 4 ? 'block' : '')."\t". ($bitfield & 8 ? 'upstr' : '')."\t". ($bitfield & 16 ? 'OOB' : '')."\n"; } print "$ip\t**moron listing**\n" if $bitfield & 128; # last if $. > 180; }