| 318 |
richard |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
2 |
<HTML><!-- written by Rexy -->
|
|
|
3 |
<HEAD>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
5 |
<?
|
| 2521 |
armand.ito |
6 |
$bl_dir="/etc/e2guardian/lists/blacklists/";
|
| 1332 |
richard |
7 |
$bl_iptables_dir="/usr/local/share/iptables-bl/";
|
| 1377 |
richard |
8 |
$wl_iptables_dir="/usr/local/share/iptables-wl/";
|
| 2688 |
lucas.echa |
9 |
$bl_unbound_dir="/usr/local/share/unbound-bl/";
|
|
|
10 |
$wl_unbound_dir="/usr/local/share/unbound-wl/";
|
| 318 |
richard |
11 |
# Choice of language
|
|
|
12 |
$Language = 'en';
|
| 3179 |
rexy |
13 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
| 1332 |
richard |
14 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
15 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
| 318 |
richard |
16 |
}
|
| 3179 |
rexy |
17 |
if($Language == 'fr'){
|
| 1852 |
raphael.pi |
18 |
$l_title = "Catégories de la liste noire";
|
|
|
19 |
$l_error_open_file="Erreur d'ouverture du fichier";
|
|
|
20 |
$l_close="Fermer";
|
|
|
21 |
$l_description_cat="Cette catégorie n'est pas décrite";
|
|
|
22 |
$l_name_cat ="Cette catégorie n'a pas de nom";
|
| 1955 |
richard |
23 |
$l_nb_domains="Nombre de noms de domaine :";
|
|
|
24 |
$l_nb_urls="Nombre d'URLs :";
|
|
|
25 |
$l_nb_ip="Nombre d'adresses IP :";
|
| 1852 |
raphael.pi |
26 |
$l_example="Exemple(s) : ";
|
|
|
27 |
$l_error_cat = "Erreur de categorie";
|
|
|
28 |
$l_error_list = "Erreur de listing";
|
| 2853 |
rexy |
29 |
} else if ($Language == 'es') {
|
|
|
30 |
$l_title = "Categorías de la lista negra";
|
|
|
31 |
$l_error_open_file="Error de apertura del archivo";
|
|
|
32 |
$l_close="Cerrar";
|
|
|
33 |
$l_description_cat="Esta categoría no se describe";
|
|
|
34 |
$l_name_cat ="Esta categoría no tiene nombre";
|
|
|
35 |
$l_nb_domains=" número de nombres de dominio :";
|
|
|
36 |
$l_nb_urls="Número de URLs :";
|
|
|
37 |
$l_nb_ip="Número de direcciones IP :";
|
|
|
38 |
$l_example="Ejemplo(s) : ";
|
|
|
39 |
$l_error_cat = "Error de categoría";
|
|
|
40 |
$l_error_list = "Error de listado";
|
|
|
41 |
} else {
|
| 1332 |
richard |
42 |
$l_title = "Blacklist categories";
|
|
|
43 |
$l_error_open_file="Error opening the file";
|
|
|
44 |
$l_close="Close";
|
| 1936 |
richard |
45 |
$l_description_cat="This category isn't described";
|
|
|
46 |
$l_name_cat ="This category has no name";
|
| 1955 |
richard |
47 |
$l_nb_domains="Number of domain names :";
|
|
|
48 |
$l_nb_urls="Number of URLs :";
|
|
|
49 |
$l_nb_ip="Number of IP addresses :";
|
| 1332 |
richard |
50 |
$l_example="Example(s) : ";
|
| 1852 |
raphael.pi |
51 |
$l_error_cat = "Error category";
|
|
|
52 |
$l_error_list = "Error listing";
|
| 1332 |
richard |
53 |
}
|
| 3179 |
rexy |
54 |
if(isset($_GET['cat'])){
|
| 1332 |
richard |
55 |
$categorie = $_GET['cat'];
|
| 2688 |
lucas.echa |
56 |
}
|
| 3179 |
rexy |
57 |
else {
|
| 1852 |
raphael.pi |
58 |
$categorie = $l_error_cat;
|
|
|
59 |
}
|
| 3179 |
rexy |
60 |
$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
|
|
|
61 |
$bl_categorie_url_file = $bl_dir.$categorie."/urls";
|
|
|
62 |
$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
|
|
|
63 |
//don't calc again on reload (click on the number of domain/urls/ip)
|
|
|
64 |
if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip'])){
|
|
|
65 |
$nb_domains = $_GET['nb_domains'];
|
|
|
66 |
$nb_urls = $_GET['nb_urls'];
|
|
|
67 |
$nb_ip = $_GET['nb_ip'];
|
| 1332 |
richard |
68 |
}
|
| 3179 |
rexy |
69 |
else {
|
|
|
70 |
if (file_exists($bl_categorie_domain_file)){
|
| 2688 |
lucas.echa |
71 |
# two lines per domain
|
|
|
72 |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2;
|
|
|
73 |
}
|
| 3179 |
rexy |
74 |
else {
|
| 1332 |
richard |
75 |
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
|
| 2688 |
lucas.echa |
76 |
}
|
| 3179 |
rexy |
77 |
if (file_exists($bl_categorie_url_file)){
|
| 1332 |
richard |
78 |
$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
|
| 2688 |
lucas.echa |
79 |
}
|
| 3179 |
rexy |
80 |
else {
|
| 1332 |
richard |
81 |
$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
|
| 2688 |
lucas.echa |
82 |
}
|
| 3179 |
rexy |
83 |
if(file_exists($bl_categorie_ip_file)){
|
| 1332 |
richard |
84 |
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
|
| 2688 |
lucas.echa |
85 |
}
|
| 3179 |
rexy |
86 |
else {
|
| 1332 |
richard |
87 |
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
|
| 1936 |
richard |
88 |
}
|
| 1332 |
richard |
89 |
}
|
| 1325 |
richard |
90 |
$global_usage = file($bl_dir."global_usage");
|
|
|
91 |
$langue = strtoupper($Language);
|
| 3179 |
rexy |
92 |
if(isset($categorie)){
|
| 1852 |
raphael.pi |
93 |
$fin1 = 0; $fin2 = 0;
|
| 3179 |
rexy |
94 |
foreach ($global_usage as $line){
|
|
|
95 |
if(preg_match("#^NAME:.$categorie$#", $line) == 1){
|
| 1852 |
raphael.pi |
96 |
$fin1 = 1;
|
| 2688 |
lucas.echa |
97 |
}
|
| 3179 |
rexy |
98 |
if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1){
|
| 1852 |
raphael.pi |
99 |
$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
|
| 2688 |
lucas.echa |
100 |
}
|
| 3179 |
rexy |
101 |
if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1){
|
| 1852 |
raphael.pi |
102 |
$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
|
|
|
103 |
$fin2 = 1;
|
| 1332 |
richard |
104 |
}
|
| 1852 |
raphael.pi |
105 |
if($fin2) break;
|
| 1325 |
richard |
106 |
}
|
|
|
107 |
}
|
| 318 |
richard |
108 |
echo "<TITLE>$l_title</TITLE>";
|
|
|
109 |
?>
|
| 2817 |
rexy |
110 |
<link rel="stylesheet" href="/css/acc.css" type="text/css">
|
| 318 |
richard |
111 |
</HEAD>
|
|
|
112 |
<body>
|
|
|
113 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 1852 |
raphael.pi |
114 |
<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
|
| 318 |
richard |
115 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
116 |
</TABLE>
|
|
|
117 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
| 1332 |
richard |
118 |
<tr><td valign="middle" align="left">
|
|
|
119 |
<?php
|
|
|
120 |
$compat_categorie=strtr($categorie,"-","_");
|
| 1852 |
raphael.pi |
121 |
echo "<br><center><b>$l_name_cat</b></center>";
|
|
|
122 |
echo "<center><b>$l_description_cat</b></center><br>";
|
| 3179 |
rexy |
123 |
echo "$l_nb_domains <b><a href='?cat=$categorie&filtre=$bl_categorie_domain_file&titre=domain&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_domains</a></b><br>";
|
|
|
124 |
echo "$l_nb_urls <b><a href='?cat=$categorie&filtre=$bl_categorie_url_file&titre=url&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_urls</a></b><br>";
|
|
|
125 |
echo "$l_nb_ip <b><a href='?cat=$categorie&filtre=$bl_categorie_ip_file&titre=ip&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_ip</a></b><br>";
|
| 1332 |
richard |
126 |
?>
|
|
|
127 |
</td></tr>
|
| 318 |
richard |
128 |
</TABLE>
|
|
|
129 |
<br>
|
| 1332 |
richard |
130 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
131 |
<tr><th>
|
|
|
132 |
<?php
|
| 3179 |
rexy |
133 |
if(isset($_GET["titre"])){
|
| 1332 |
richard |
134 |
$titre = $_GET["titre"];
|
|
|
135 |
}
|
| 3179 |
rexy |
136 |
else {
|
| 1332 |
richard |
137 |
$titre = "domain";
|
|
|
138 |
}
|
|
|
139 |
echo $l_example.$titre;
|
|
|
140 |
?>
|
|
|
141 |
</th></tr>
|
|
|
142 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
143 |
</TABLE>
|
|
|
144 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
145 |
<tr><td valign="middle" align="left">
|
| 1867 |
raphael.pi |
146 |
<?php
|
| 3179 |
rexy |
147 |
if($titre == "domain"){
|
|
|
148 |
exec("head -n 15 ".escapeshellarg($bl_categorie_domain_file)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
|
| 1332 |
richard |
149 |
}
|
| 3179 |
rexy |
150 |
elseif($titre == "ip"){
|
|
|
151 |
exec("head -n 15 ".escapeshellarg($bl_categorie_ip_file)." | cut -d ' ' -f3", $resultat);
|
| 1332 |
richard |
152 |
}
|
| 3179 |
rexy |
153 |
else {
|
| 3226 |
rexy |
154 |
exec("head -n 15 ".escapeshellarg($bl_categorie_url_file), $resultat);
|
| 1332 |
richard |
155 |
}
|
| 3179 |
rexy |
156 |
for($i=0; $i<count($resultat); $i++){
|
| 1332 |
richard |
157 |
echo $resultat[$i]."<br/>";
|
| 2688 |
lucas.echa |
158 |
}
|
| 1332 |
richard |
159 |
?>
|
|
|
160 |
</td></tr>
|
|
|
161 |
</TABLE>
|
| 318 |
richard |
162 |
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
|
|
|
163 |
</BODY>
|
|
|
164 |
</HTML>
|