Changeset 66 for trunk/dnsbl/DNSBLweb.pm


Ignore:
Timestamp:
01/05/18 18:06:47 (6 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Add exclusion flagging and block-comment handling to IP list tools. Exclusion
flags can be set or unset on each submit; netblock comments can be added,
updated, or removed (or at least "set empty") on each submit.

Note this is focused on the CIDR (rbldnsd) export format, and may produce
excitingly weird results with the default "classful"/tinydns mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBLweb.pm

    r59 r66  
    2121
    2222package DNSBLweb;
     23
     24use strict;
     25use warnings;
    2326
    2427use Exporter;
     
    5659  my $pblock = $args{block} || '0/0';
    5760
    58   my $basesql = "SELECT b.block,o.orgname,b.listme,o.listme,b.comments,o.comments ".
     61  my $basesql = "SELECT b.block,o.orgname,b.listme,o.listme,b.comments,o.comments,b.exclude ".
    5962       "FROM blocks b INNER JOIN orgs o ON b.orgid=o.orgid ".
    6063       "WHERE b.block <<=";
     
    6265  my $sthiplist = $dbh->prepare("SELECT * FROM iplist WHERE ip <<= ? ORDER BY ip");
    6366  $allsth->execute($pblock,$lvl);
    64   while (my ($block,$org,$listmeb,$listmeo,$bcomments,$ocomments) = $allsth->fetchrow_array) {
     67  while (my ($block,$org,$listmeb,$listmeo,$bcomments,$ocomments,$bexclude) = $allsth->fetchrow_array) {
    6568    my $tmpl = new HTML::Template(filename => "browse-block.tmpl");
    6669    my $blockcidr = new NetAddr::IP $block;
    6770    $tmpl->param(lvlclass => "lvl$lvl".($dnsbl->autolist_block($block) ? " auto$lvl" : '').
    6871       ( $ipcidr->within($blockcidr) ? ' inhere' : ''));
    69 
    70     $tmpl->param(netclass => ($listmeb ? "b$lvl".'list' : ''));
     72    # exclude takes precedence over listme
     73    $tmpl->param(netclass => ($bexclude ? 'exclude' : ($listmeb ? "b$lvl".'list' : '')));
    7174    $tmpl->param(net => $block);
    7275    $tmpl->param(orgclass => ($listmeo ? "b$lvl".'org' : ''));
     
    8184      next if $args{ipseen}->{$data4[0]};
    8285      my %iprow;
     86      my @ipclass;
    8387      $iprow{ip} = $data4[0];
    8488      $iprow{ipcount} = $data4[1];
    8589      $iprow{indent} = '  'x$lvl;
    86       $iprow{repeater} = 1 if $ip eq $data4[0];
    87 #       ip        | count | s4list |             added
     90      push @ipclass, 'repeater' if $ip eq $data4[0];
     91      push @ipclass, 'exclude' if $data4[5];
     92      $iprow{ipclass} = join(' ', @ipclass);
     93#       ip        | count | s4list |             added             |     parent     | exclude
    8894      push @iprows, \%iprow;
    8995      $args{ipseen}->{$data4[0]} = 1;
Note: See TracChangeset for help on using the changeset viewer.