source: trunk/dnsbl/export-dnsbl@ 7

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

/trunk/dnsbl

export-dnsbl

  • Spit out SOA and NS records for rbldns/cidr output, Just In Case

browse.cgi:

  • Show comments for listme(block) and listme(org) ratings

dnsbl.cgi

  • Show registrar-parent browse detail on IPs submitted for listing. Copied most of browse.cgi code into dnsbl.cgi - this should really be split out

templates/report.tmpl

  • Added space for browse list data, added reference to CSS for browse listings

templates/browse.tmpl

  • Split out CSS for browse formatting into separate file instead of inline <style> header tag

templates/dnsbl.css

  • CSS for browse data
  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author Id
File size: 2.2 KB
Line 
1#!/usr/bin/perl
2# Export DNSBL data
3# 2009/05/26 kdeugau@deepnet.cx
4# need to stub it out so it can use a module to actually write zone
5# data for different NS software
6# completed 2008/08/14
7
8use strict;
9use warnings;
10use DBI;
11
12use DNSBL;
13
14my $dnsbl = new DNSBL;
15
16$dnsbl->connect;
17
18my %iplist;
19my $ipref = \%iplist;
20
21my $mode = $ARGV[0] || 'tiny';
22
23#$dnsbl->export($ipref,$mode,1,'65.60/18');
24#$dnsbl->export($ipref,$mode,1,'67.136.0.0/14');
25#$dnsbl->export($ipref,$mode,1,'83.76/15');
26#$dnsbl->export($ipref,$mode,1,'76.73.0.0/17');
27#$dnsbl->export($ipref,$mode,1,'174.36.0.0/15');
28$dnsbl->export($ipref,$mode);
29
30##fixme - mode should pick actual output, not just export mode
31if ($mode eq 'cidr') {
32 # SOA, NS records. Maybe dnscache needs them?
33 print "\$SOA 900 company.dnsbl systems.company.com 0 1200 600 600 900\n".
34 "\$NS 3600 127.0.0.1\n".
35 "\$TTL 900\n";
36
37 # more or less raw CIDR block-and-IP info. rbldnsd format for convenience.
38 foreach (sort ipcmp keys %iplist) {
39 print "$_:127.0.0.$iplist{$_}:".
40 ($iplist{$_} & 2 ? '$ relayed a reported spam' : 'Netblock listed on one or more criteria')."\n";
41 }
42} else {
43 foreach (sort ipcmp keys %iplist) {
44 my ($o1,$o2,$o3,$o4) = (/^(\d+)\.([\d*]+)(?:\.([\d*]+)(?:\.([\d*]+))?)?$/);
45 print "+".(defined($o4) ? "$o4." : '').(defined($o3) ? "$o3." : '').(defined($o2) ? "$o2." : '').
46 "$o1.spamhosts.company.com:127.0.0.$iplist{$_}:900:::\n";
47 }
48}
49
50exit 0;
51
52# IP address comparison sub
53sub ipcmp {
54 my ($a1,$a2,$a3,$a4,$a5) = ($a =~ /^(\d+)\.([\d*]+)(?:\.([\d*]+)(?:\.([\d*]+))?)?(?:\/(\d+))?$/);
55 my ($b1,$b2,$b3,$b4,$b5) = ($b =~ /^(\d+)\.([\d*]+)(?:\.([\d*]+)(?:\.([\d*]+))?)?(?:\/(\d+))?$/);
56# le sigh. knew it wasn't going to be simple...
57 $b2 = -1 if $b2 && $b2 eq '*';
58 $b3 = -1 if $b3 && $b3 eq '*';
59 $b4 = -1 if $b4 && $b4 eq '*';
60 $b5 = 128 if !defined($b5);
61 $a2 = -1 if $a2 && $a2 eq '*';
62 $a3 = -1 if $a3 && $a3 eq '*';
63 $a4 = -1 if $a4 && $a4 eq '*';
64 $a5 = 128 if !defined($a5);
65 return 1 if $a1 > $b1;
66 return -1 if $a1 < $b1;
67 return 1 if $a2 > $b2;
68 return -1 if $a2 < $b2;
69 return 1 if $a3 > $b3;
70 return -1 if $a3 < $b3;
71 return 1 if $a4 > $b4;
72 return -1 if $a4 < $b4;
73 return 1 if $a5 > $b5;
74 return -1 if $a5 < $b5;
75 return 0;
76}
Note: See TracBrowser for help on using the repository browser.