- Timestamp:
- 09/09/09 15:18:13 (15 years ago)
- Location:
- trunk/dnsbl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dnsbl/DNSBL.pm
r2 r3 297 297 $level--; 298 298 299 # need this for a bunch of things, may as well do it here 300 my ($masklen) = ($container =~ m|/(\d+)$|); 301 299 302 # Snag all parent block "is-it-listed?" data, and stuff it into a single 300 303 # variable we can use later. Much faster than retrieving this data 301 304 # individually, for each octet iteration. 302 305 306 my $mycount = 0; 303 307 my $sql = "SELECT count(i.ip),b.block,b.level,b.listme AS oobblock,o.listme AS ooborg ". 304 308 "FROM iplist i INNER JOIN blocks b ON i.ip << b.block INNER JOIN orgs o ON b.orgid = o.orgid ". 305 309 "WHERE b.block >>= ? ". 306 310 "GROUP BY b.block,b.level,b.listme,o.listme ORDER BY b.block"; 307 308 311 my $parsth = $dbh->prepare($sql); 309 312 $parsth->execute($container); … … 314 317 $pdata |= $bitfields{block} if $pblock; 315 318 $pdata |= $bitfields{org} if $porg; 316 } 317 318 if ($mode eq 'cidr') { 319 $listhosts->{$container} |= $pdata if $pdata; 319 $mycount = $pcount if $p eq $container; 320 } 321 322 if ($mode eq 'cidr' || $mode eq 'rbldnsd') { 323 $listhosts->{$container} |= $pdata if $pdata && ($ooborg || $oobblock || ($mycount >= $autolist{$masklen})); 320 324 } else { 321 322 325 # if $cidr->masklen is <= 24, iterate on /24 boundaries for bulk sublisting 323 326 # if $cidr->masklen is <= 16, iterate on /16 boundaries for bulk sublisting 324 327 # if $cidr->masklen is <= 8, iterate on /8 boundaries for bulk sublisting 325 328 326 my ($masklen) = ($container =~ m|/(\d+)$|);327 329 if ($pdata) { 328 330 my @blocksubs; -
trunk/dnsbl/browse.cgi
r2 r3 23 23 "WHERE b.block <<= "; 24 24 my $sth0 = $dbh->prepare($basesql."'0/0' AND b.level=0 ORDER BY block"); 25 #my $sth0 = $dbh->prepare($basesql."' 174.36.0.0/15' AND b.level=0 ORDER BY block");25 #my $sth0 = $dbh->prepare($basesql."'76.73.0.0/17' AND b.level=0 ORDER BY block"); 26 26 my $sth1 = $dbh->prepare($basesql."? AND b.level=1 ORDER BY block"); 27 27 my $sth2 = $dbh->prepare($basesql."? AND b.level=2 ORDER BY block"); -
trunk/dnsbl/export-dnsbl
r2 r3 19 19 my $ipref = \%iplist; 20 20 21 my $mode = $ARGV[0] || ' cidr';21 my $mode = $ARGV[0] || 'tiny'; 22 22 23 23 #$dnsbl->export($ipref,$mode,1,'65.60/18'); 24 24 #$dnsbl->export($ipref,$mode,1,'67.136.0.0/14'); 25 25 #$dnsbl->export($ipref,$mode,1,'83.76/15'); 26 #$dnsbl->export($ipref,$mode,1,'95.154.192.0/18'); 27 $dnsbl->export($ipref); 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); 28 29 29 30 ##fixme - mode should pick actual output, not just export mode 30 31 if ($mode eq 'cidr') { 32 # more or less raw CIDR block-and-IP info 31 33 foreach (sort ipcmp keys %iplist) { 32 print "$_\t$iplist{$_}\n"; 34 print "$_:127.0.0.$iplist{$_}:". 35 ($iplist{$_} & 2 ? '$ relayed a reported spam' : 'Netblock listed on one or more criteria')."\n"; 33 36 } 37 } elsif ($mode eq 'rbldnsd') { 38 # need extra cmd args 39 die "need subgroup spec (iplist, cidrlist) as well\n" if !$ARGV[1]; 40 if ($ARGV[1] eq 'iplist') { 41 foreach (sort ipcmp keys %iplist) { 42 print "$_:127.0.0.$iplist{$_}:\$ relayed a reported spam\n" if $iplist{$_} & 2; 43 } 44 } elsif ($ARGV[1] eq 'cidrlist') { 45 foreach (sort ipcmp keys %iplist) { 46 print "$_:127.0.0.$iplist{$_}:Netblock listed on one or more criteria\n" if ! ($iplist{$_} & 2); 47 } 48 } 49 # no output if second arg is unknown. 34 50 } else { 35 51 foreach (sort ipcmp keys %iplist) {
Note:
See TracChangeset
for help on using the changeset viewer.