6,8 → 6,8 |
$bl_dir="/etc/e2guardian/lists/blacklists/"; |
$bl_iptables_dir="/usr/local/share/iptables-bl/"; |
$wl_iptables_dir="/usr/local/share/iptables-wl/"; |
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/"; |
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-wl/"; |
$bl_unbound_dir="/usr/local/share/unbound-bl/"; |
$wl_unbound_dir="/usr/local/share/unbound-wl/"; |
# Choice of language |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
42,12 → 42,11 |
$l_example="Example(s) : "; |
$l_error_cat = "Error category"; |
$l_error_list = "Error listing"; |
|
} |
if(isset($_GET['cat'])) |
{ |
$categorie = $_GET['cat']; |
} |
} |
else |
{ |
$categorie = $l_error_cat; |
61,48 → 60,73 |
$liste = $l_error_list; |
} |
if($liste == "bl") |
{ |
$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf"; |
{ |
$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf"; |
$bl_categorie_url_file = $bl_dir.$categorie."/urls"; |
$bl_categorie_ip_file = $bl_iptables_dir.$categorie; |
//don't calc again on reload (click on the number of domain/urls/ip) |
if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip'])) |
{ |
{ |
$nb_domains = $_GET['nb_domains']; |
$nb_urls = $_GET['nb_urls']; |
$nb_ip = $_GET['nb_ip']; |
} |
} |
else |
{ |
if (file_exists($bl_categorie_domain_file)) |
{ |
if (file_exists($bl_categorie_domain_file)) |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1"); |
# two lines per domain |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2; |
} |
else |
{ |
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file; |
} |
|
if (file_exists($bl_categorie_url_file)) |
{ |
$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1"); |
} |
else |
{ |
$nb_urls = $l_error_open_file." ".$bl_categorie_url_file; |
} |
|
if(file_exists($bl_categorie_ip_file)) |
{ |
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1"); |
} |
else |
{ |
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file; |
} |
} |
} |
else |
{ |
$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf"; |
{ |
$wl_categorie_domain_file = $wl_unbound_dir.$categorie.".conf"; |
$wl_categorie_ip_file = $wl_iptables_dir.$categorie; |
if (file_exists($wl_categorie_domain_file)) |
{ |
$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1"); |
} |
else |
{ |
$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file; |
} |
|
if (file_exists($wl_categorie_ip_file)) |
{ |
$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1"); |
} |
else |
{ |
$nb_ip = 0; |
//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file; |
} |
|
$nb_urls = 0; //no urls in WL |
} |
} |
$global_usage = file($bl_dir."global_usage"); |
$langue = strtoupper($Language); |
if(isset($categorie)) |
111,9 → 135,13 |
foreach($global_usage as $line) |
{ |
if(preg_match("#^NAME:.$categorie$#", $line) == 1) |
{ |
$fin1 = 1; |
} |
if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1) |
{ |
$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line); |
} |
if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1) |
{ |
$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line); |
178,7 → 206,7 |
{ |
|
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file; |
exec("head -n 15 ".escapeshellarg($filtre)." | cut -d '/' -f2", $resultat); |
exec("head -n 15 ".escapeshellarg($filtre)." | grep 'transparent' | awk '{ print $2 }'", $resultat); |
} |
elseif($titre == "ip") |
{ |
190,7 → 218,9 |
exec("head -n 15 ".escapeshellarg($filtre), $resultat); |
} |
for($i=0; $i<count($resultat); $i++) |
{ |
echo $resultat[$i]."<br/>"; |
} |
?> |
</td></tr> |
</TABLE> |
197,4 → 227,3 |
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center> |
</BODY> |
</HTML> |
|