From b826f027192c51b86684a06a572c0aca82cb0a58 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Tue, 1 Nov 2011 01:47:50 -0200 Subject: pfBlocker - version 0.1.4 changes alias/lists/rules engine and gui --- config/pf-blocker/pfBlocker.widget.php | 64 +++++++++++++++------------------- 1 file changed, 29 insertions(+), 35 deletions(-) (limited to 'config/pf-blocker/pfBlocker.widget.php') diff --git a/config/pf-blocker/pfBlocker.widget.php b/config/pf-blocker/pfBlocker.widget.php index ec1d08a2..6830275a 100644 --- a/config/pf-blocker/pfBlocker.widget.php +++ b/config/pf-blocker/pfBlocker.widget.php @@ -33,49 +33,43 @@ echo ""; -$in=""; -$out=""; -$white=""; +$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); + } + } + } $rules=$config['filter']['rule']; #echo "
";
 foreach($rules as $rule){
-	if ($rule['destination']['address'] == 'pfBlockerOutbound' && $out == ""){
-		#print_r($rule);
-		$out="";
-	}
-		
-	if ($rule['source']['address']== 'pfBlockerInbound' && $in == "")
-		$in="";
+	if (preg_match("/pfBlocker/",$rule['source']['address']))
+		$pfb_table[$rule['source']['address']]["img"]=$in;
 		
-	if ($rule['source']['address']== 'pfBlockerWL' && $white == "")
-		$white="";
-		
-	if ($rule['destination']['address']== 'pfBlockerWL' && $white == "")
-		$white="";
+	if (preg_match("/pfBlocker/",$rule['destination']['address']))
+		$pfb_table[$rule['destination']['address']]["img"]=$in;
 }
+print "
";
+#var_dump($pfb_table);
+#exit;
+	print "
"; + print ""; + print ""; -$in=($in != ""?$in:""); -$out=($out != ""?$out:""); -$white=($white != ""?$white:""); - -echo " "; -echo " "; -echo " "; -echo" "; -echo" "; -if (file_exists("/usr/local/pkg/pfb_in.txt")) { - $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_in.txt"),$matches); - echo " "; +foreach ($pfb_table as $alias => $values){ + print ""; + print ""; + print ""; } -if (file_exists("/usr/local/pkg/pfb_out.txt")) { - $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_out.txt"),$matches); - echo " "; -} -if (file_exists("/usr/local/pkg/pfb_w.txt")) { - $resultsIP = preg_match_all("/\//",file_get_contents("/usr/local/pkg/pfb_w.txt"),$matches); - echo " ";} - echo" "; echo"
AliasCIDRsStatus
pfBlockerInbound".$in."pfBlockerOutbound".$out."pfBlockerWL".$white."
". count($matches[0])." Networks".$alias ."".$values["count"]."".$values["img"]."
" . count($matches[0])." Networks" . count($matches[0])." Networks
"; +exit; ?> \ No newline at end of file -- cgit v1.2.3