";
$pfb_table=array();
$out="
";
$in="
";
if (is_array($config['aliases']['alias']))
foreach ($config['aliases']['alias'] as $cbalias){
if (preg_match("/pfBlocker/",$cbalias['name'])){
if (file_exists('/var/db/aliastables/'.$cbalias['name'].'.txt')){
preg_match("/(\d+)/",exec("/usr/bin/wc -l /var/db/aliastables/".$cbalias['name'].".txt"),$matches);
$pfb_table[$cbalias['name']]=array("count" => $matches[1],
"img"=> $out);
}
}
}
#check rule count
#(label, evaluations,packets total, bytes total, packets in, bytes in,packets out, bytes out)
$packets=exec("/sbin/pfctl -s labels",$debug);
foreach ($debug as $line){
#USER_RULE: pfBlocker Outbound rule 1656 0 0 0 0 0 0
if (preg_match("/USER_RULE: (\w+).*\s+\d+\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+/",$line,$matches))
${$matches[1]}+=$matches[2];
}
$rules=$config['filter']['rule'];
#echo "
";
foreach($rules as $rule){
if (preg_match("/pfBlocker/",$rule['source']['address']))
$pfb_table[$rule['source']['address']]["img"]=$in;
if (preg_match("/pfBlocker/",$rule['destination']['address']))
$pfb_table[$rule['destination']['address']]["img"]=$in;
}
print "";
#var_dump($pfb_table);
#exit;
print "Alias | ";
print "CIDRs | ";
print "Packets | ";
print "Status | ";
foreach ($pfb_table as $alias => $values){
print "".$alias ." | ";
print "".$values["count"]." | ";
print "".${$alias}." | ";
print "".$values["img"]." | ";
}
echo" ";
echo"
";
?>