Changeset 22 for trunk/dnsbl/dnsbl.cgi


Ignore:
Timestamp:
08/30/10 15:13:38 (14 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Extend browse listing in reporting to indicate containing blocks
and repeat-offender IPs, as well as show containing block on report
finalize page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/dnsbl.cgi

    r19 r22  
    8989  $page->param(ip => $webvar{ip});
    9090  $page->param(err => $err);
     91
     92  $page->param(browsebits => browse($dbh,$webvar{ip}));
    9193}
    9294print $page->output;
     
    101103  my $dbh = shift;
    102104  my $ip = shift;
     105  my $ipcidr = new NetAddr::IP $ip;
    103106
    104107  my $basesql = "SELECT b.block,o.orgname,b.listme,o.listme,b.comments,o.comments ".
     
    118121  $sth0->execute($ip);
    119122  while (my ($block0,$org0,$listmeb0,$listmeo0,$bcomments0,$ocomments0) = $sth0->fetchrow_array) {
    120     $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : ''));
     123    my $block0cidr = new NetAddr::IP $block0;
     124    $tmpl0->param(lvlclass => 'lvl0'.($dnsbl->autolist_block($block0) ? ' auto0' : '').
     125        ( $ipcidr->within($block0cidr) ? ' inhere' : ''));
    121126    $tmpl0->param(netclass => ($listmeb0 ? 'b0list' : ''));
    122127    $tmpl0->param(net => $block0);
     
    129134    if ($sth1->rows > 0) {
    130135      while (my ($block1,$org1,$listmeb1,$listmeo1,$bcomments1,$ocomments1) = $sth1->fetchrow_array) {
     136        my $block1cidr = new NetAddr::IP $block1;
    131137        my $tmpl1 = new HTML::Template(filename => 'templates/browse-block.tmpl');
    132         $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : ''));
     138        $tmpl1->param(lvlclass => 'lvl1'.($dnsbl->autolist_block($block1) ? ' auto1' : '').
     139                ( $ipcidr->within($block1cidr) ? ' inhere' : ''));
    133140        $tmpl1->param(netclass => ($listmeb1 ? 'b1list' : ''));
    134141        $tmpl1->param(net => $block1);
     
    142149        if ($sth2->rows > 0) {
    143150          while (my ($block2,$org2,$listmeb2,$listmeo2,$bcomments2,$ocomments2) = $sth2->fetchrow_array) {
     151            my $block2cidr = new NetAddr::IP $block2;
    144152            my $tmpl2 = new HTML::Template(filename => 'templates/browse-block.tmpl');
    145             $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : ''));
     153            $tmpl2->param(lvlclass => 'lvl2'.($dnsbl->autolist_block($block2) ? ' auto2' : '').
     154                ( $ipcidr->within($block2cidr) ? ' inhere' : ''));
    146155            $tmpl2->param(netclass => ($listmeb2 ? 'b2list' : ''));
    147156            $tmpl2->param(net => $block2);
     
    158167              $iprow{ipcount} = $data4[1];
    159168              $iprow{indent} = '    ';
     169              $iprow{repeater} = 1 if $ip eq $data4[0];
    160170#       ip        | count | s4list |             added
    161171              push @iprows, \%iprow;
     
    175185          $iprow{ipcount} = $data4[1];
    176186          $iprow{indent} = '  ';
     187          $iprow{repeater} = 1 if $ip eq $data4[0];
    177188#       ip        | count | s4list |             added
    178189          push @iprows, \%iprow;
     
    193204      $iprow{ipcount} = $data4[1];
    194205      $iprow{indent} = '';
     206      $iprow{repeater} = 1 if $ip eq $data4[0];
    195207#       ip        | count | s4list |             added
    196208      push @iprows, \%iprow;
Note: See TracChangeset for help on using the changeset viewer.