| 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 |
<?
|
|
|
6 |
$bl_dir="/etc/dansguardian/lists/blacklists/";
|
| 1332 |
richard |
7 |
$bl_iptables_dir="/usr/local/share/iptables-bl/";
|
| 1377 |
richard |
8 |
$wl_iptables_dir="/usr/local/share/iptables-wl/";
|
| 1332 |
richard |
9 |
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
|
|
|
10 |
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-wl/";
|
| 1867 |
raphael.pi |
11 |
if(isset($_GET['ossi'])) $ossi = $_GET['ossi'];
|
| 318 |
richard |
12 |
# Choice of language
|
|
|
13 |
$Language = 'en';
|
| 1332 |
richard |
14 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
|
|
15 |
{
|
|
|
16 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
17 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
| 318 |
richard |
18 |
}
|
| 1332 |
richard |
19 |
if($Language == 'fr')
|
|
|
20 |
{
|
| 1852 |
raphael.pi |
21 |
$l_title = "Catégories de la liste noire";
|
|
|
22 |
$l_error_open_file="Erreur d'ouverture du fichier";
|
|
|
23 |
$l_close="Fermer";
|
|
|
24 |
$l_description_cat="Cette catégorie n'est pas décrite";
|
|
|
25 |
$l_name_cat ="Cette catégorie n'a pas de nom";
|
|
|
26 |
$l_nb_domains="Nombre de noms de domaine filtrés :";
|
|
|
27 |
$l_nb_urls="Nombre d'URL filtrés :";
|
|
|
28 |
$l_nb_ip="Nombre d'IP filtrées :";
|
|
|
29 |
$l_example="Exemple(s) : ";
|
|
|
30 |
$l_error_cat = "Erreur de categorie";
|
|
|
31 |
$l_error_list = "Erreur de listing";
|
| 1903 |
raphael.pi |
32 |
$l_tor_node = "Cette liste correspond au noeud du réseau Tor. Si cette liste est activée, les utilisateurs blacklistés ne pourront pas accéder au réseau Tor</br>";
|
| 318 |
richard |
33 |
}
|
|
|
34 |
else
|
| 1332 |
richard |
35 |
{
|
|
|
36 |
$l_title = "Blacklist categories";
|
|
|
37 |
$l_error_open_file="Error opening the file";
|
|
|
38 |
$l_close="Close";
|
|
|
39 |
$l_description_cat="This category isn't describe";
|
| 1852 |
raphael.pi |
40 |
$l_name_cat ="This category has not name";
|
| 1332 |
richard |
41 |
$l_nb_domains="Number of filtered domain names :";
|
|
|
42 |
$l_nb_urls="Number of filtered URL :";
|
|
|
43 |
$l_nb_ip="Number of filtered IP :";
|
|
|
44 |
$l_example="Example(s) : ";
|
| 1852 |
raphael.pi |
45 |
$l_error_cat = "Error category";
|
|
|
46 |
$l_error_list = "Error listing";
|
| 1903 |
raphael.pi |
47 |
$l_tor_node = "This list is Tor's nodes. If you enable this list, users won't reach Tor network.</br> ";
|
| 1852 |
raphael.pi |
48 |
|
| 1332 |
richard |
49 |
}
|
|
|
50 |
if(isset($_GET['cat']))
|
|
|
51 |
{
|
|
|
52 |
$categorie = $_GET['cat'];
|
|
|
53 |
}
|
| 1852 |
raphael.pi |
54 |
else
|
|
|
55 |
{
|
|
|
56 |
$categorie = $l_error_cat;
|
|
|
57 |
}
|
| 1332 |
richard |
58 |
if(isset($_GET['liste']))
|
|
|
59 |
{
|
|
|
60 |
$liste = $_GET['liste'];
|
|
|
61 |
}
|
| 1852 |
raphael.pi |
62 |
else
|
|
|
63 |
{
|
|
|
64 |
$liste = $l_error_list;
|
|
|
65 |
}
|
| 1332 |
richard |
66 |
if($liste == "bl")
|
|
|
67 |
{
|
| 1867 |
raphael.pi |
68 |
if(isset($ossi))
|
|
|
69 |
{
|
| 1899 |
raphael.pi |
70 |
if(isset($_GET['state']) && $_GET['state']=='disable')
|
|
|
71 |
{
|
|
|
72 |
$bl_categorie_domain_file = "/usr/local/share/dnsmasq-bl/".$categorie;
|
|
|
73 |
$bl_categorie_ip_file = "/usr/local/share/iptables-bl/".$categorie;
|
|
|
74 |
}
|
|
|
75 |
else
|
|
|
76 |
{
|
|
|
77 |
$bl_categorie_domain_file = "/usr/local/share/dnsmasq-bl-enabled/".$categorie;
|
|
|
78 |
$bl_categorie_ip_file = "/usr/local/share/iptables-bl-enabled/".$categorie;
|
|
|
79 |
}
|
| 1867 |
raphael.pi |
80 |
if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
|
|
|
81 |
{
|
|
|
82 |
$nb_domains = $_GET['nb_domains'];
|
|
|
83 |
$nb_ip = $_GET['nb_ip'];
|
|
|
84 |
}
|
|
|
85 |
else
|
|
|
86 |
{
|
|
|
87 |
if (file_exists($bl_categorie_domain_file))
|
| 1903 |
raphael.pi |
88 |
{
|
| 1867 |
raphael.pi |
89 |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
|
| 1903 |
raphael.pi |
90 |
}
|
| 1867 |
raphael.pi |
91 |
else
|
| 1903 |
raphael.pi |
92 |
{
|
| 1904 |
raphael.pi |
93 |
if($categorie!='ossi-tor_node_ip')
|
| 1903 |
raphael.pi |
94 |
{
|
|
|
95 |
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
|
|
|
96 |
}
|
|
|
97 |
else
|
|
|
98 |
{
|
|
|
99 |
$nb_domains = "";
|
|
|
100 |
$_GET["titre"] = 'ip';
|
|
|
101 |
}
|
|
|
102 |
}
|
| 1867 |
raphael.pi |
103 |
if(file_exists($bl_categorie_ip_file))
|
|
|
104 |
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
|
|
|
105 |
else
|
|
|
106 |
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
else
|
|
|
110 |
{
|
|
|
111 |
|
|
|
112 |
|
| 1332 |
richard |
113 |
$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
|
|
|
114 |
$bl_categorie_url_file = $bl_dir.$categorie."/urls";
|
|
|
115 |
$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
|
|
|
116 |
if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
|
|
|
117 |
{
|
|
|
118 |
$nb_domains = $_GET['nb_domains'];
|
|
|
119 |
$nb_urls = $_GET['nb_urls'];
|
|
|
120 |
$nb_ip = $_GET['nb_ip'];
|
|
|
121 |
}
|
|
|
122 |
else
|
|
|
123 |
{
|
|
|
124 |
if (file_exists($bl_categorie_domain_file))
|
|
|
125 |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
|
|
|
126 |
else
|
|
|
127 |
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
|
|
|
128 |
if (file_exists($bl_categorie_url_file))
|
|
|
129 |
$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
|
|
|
130 |
else
|
|
|
131 |
$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
|
|
|
132 |
if(file_exists($bl_categorie_ip_file))
|
|
|
133 |
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
|
|
|
134 |
else
|
|
|
135 |
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
|
|
|
136 |
}
|
| 1867 |
raphael.pi |
137 |
}
|
| 1332 |
richard |
138 |
}
|
| 318 |
richard |
139 |
else
|
| 1332 |
richard |
140 |
{
|
| 1867 |
raphael.pi |
141 |
|
|
|
142 |
if(isset($ossi))
|
|
|
143 |
{
|
| 1899 |
raphael.pi |
144 |
if(isset($_GET['state']) && $_GET['state']=='disable')
|
|
|
145 |
{
|
|
|
146 |
$wl_categorie_domain_file = "/usr/local/share/dnsmasq-wl/".$categorie;
|
|
|
147 |
$wl_categorie_ip_file = "/usr/local/share/iptables-wl/".$categorie;
|
|
|
148 |
}
|
|
|
149 |
else
|
|
|
150 |
{
|
|
|
151 |
$wl_categorie_domain_file = "/usr/local/share/dnsmasq-wl-enabled/".$categorie;
|
|
|
152 |
$wl_categorie_ip_file = "/usr/local/share/iptables-wl-enabled/".$categorie;
|
|
|
153 |
}
|
| 1867 |
raphael.pi |
154 |
if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
|
|
|
155 |
{
|
|
|
156 |
$nb_domains = $_GET['nb_domains'];
|
|
|
157 |
$nb_ip = $_GET['nb_ip'];
|
|
|
158 |
}
|
|
|
159 |
else
|
|
|
160 |
{
|
|
|
161 |
if (file_exists($wl_categorie_domain_file))
|
|
|
162 |
$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
|
|
|
163 |
else
|
|
|
164 |
$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
|
|
|
165 |
if(file_exists($wl_categorie_ip_file))
|
|
|
166 |
$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
|
|
|
167 |
else
|
|
|
168 |
$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
|
|
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
else
|
|
|
172 |
{
|
| 1332 |
richard |
173 |
$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
|
| 1377 |
richard |
174 |
$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
|
| 1390 |
richard |
175 |
if(isset($_GET['nb_domains']))
|
| 1377 |
richard |
176 |
{
|
|
|
177 |
$nb_domains = $_GET['nb_domains'];
|
|
|
178 |
$nb_urls = 0;
|
| 1390 |
richard |
179 |
$nb_ip = 0;
|
| 1377 |
richard |
180 |
}
|
| 1332 |
richard |
181 |
else
|
| 1377 |
richard |
182 |
{
|
|
|
183 |
if (file_exists($wl_categorie_domain_file))
|
|
|
184 |
$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
|
|
|
185 |
else
|
|
|
186 |
$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
|
|
|
187 |
$nb_urls = 0;
|
| 1390 |
richard |
188 |
$nb_ip = 0;
|
| 1377 |
richard |
189 |
}
|
| 1867 |
raphael.pi |
190 |
}
|
| 1332 |
richard |
191 |
}
|
| 1325 |
richard |
192 |
$global_usage = file($bl_dir."global_usage");
|
|
|
193 |
$langue = strtoupper($Language);
|
| 1867 |
raphael.pi |
194 |
if(isset($categorie) && !isset($ossi))
|
| 1325 |
richard |
195 |
{
|
| 1852 |
raphael.pi |
196 |
$fin1 = 0; $fin2 = 0;
|
|
|
197 |
foreach($global_usage as $line)
|
| 1325 |
richard |
198 |
{
|
| 1852 |
raphael.pi |
199 |
if(preg_match("#^NAME:.$categorie$#", $line) == 1)
|
|
|
200 |
$fin1 = 1;
|
|
|
201 |
if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
|
|
|
202 |
$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
|
|
|
203 |
if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
|
| 1332 |
richard |
204 |
{
|
| 1852 |
raphael.pi |
205 |
$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
|
|
|
206 |
$fin2 = 1;
|
| 1332 |
richard |
207 |
}
|
| 1852 |
raphael.pi |
208 |
if($fin2) break;
|
|
|
209 |
|
| 1325 |
richard |
210 |
}
|
|
|
211 |
}
|
| 318 |
richard |
212 |
echo "<TITLE>$l_title</TITLE>";
|
|
|
213 |
?>
|
|
|
214 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
215 |
</HEAD>
|
|
|
216 |
<body>
|
|
|
217 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 1852 |
raphael.pi |
218 |
<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
|
| 318 |
richard |
219 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
220 |
</TABLE>
|
|
|
221 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
| 1332 |
richard |
222 |
<tr><td valign="middle" align="left">
|
|
|
223 |
<?php
|
|
|
224 |
if(isset($_GET["filtre"]))
|
|
|
225 |
{
|
|
|
226 |
$filtre = $_GET["filtre"];
|
|
|
227 |
}
|
|
|
228 |
else
|
|
|
229 |
{
|
|
|
230 |
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
|
|
|
231 |
}
|
| 1904 |
raphael.pi |
232 |
if($categorie!='ossi-tor_node_ip')
|
| 1903 |
raphael.pi |
233 |
$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
|
| 1894 |
raphael.pi |
234 |
if(!isset($ossi))
|
|
|
235 |
$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
|
| 1332 |
richard |
236 |
$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
|
|
|
237 |
$compat_categorie=strtr($categorie,"-","_");
|
| 1867 |
raphael.pi |
238 |
if(!isset($ossi))
|
|
|
239 |
{
|
| 1852 |
raphael.pi |
240 |
echo "<br><center><b>$l_name_cat</b></center>";
|
|
|
241 |
echo "<center><b>$l_description_cat</b></center><br>";
|
| 1332 |
richard |
242 |
echo "$l_nb_domains <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_domain&titre=domain&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_domains</a></b><br>";
|
|
|
243 |
echo "$l_nb_urls <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_url&titre=url&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_urls</a></b><br>";
|
|
|
244 |
echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_urls=$nb_urls&nb_ip=$nb_ip'>$nb_ip</a></b><br>";
|
| 1867 |
raphael.pi |
245 |
}
|
|
|
246 |
else
|
|
|
247 |
{
|
| 1904 |
raphael.pi |
248 |
if($categorie=='ossi-tor_node_ip')
|
| 1903 |
raphael.pi |
249 |
{
|
|
|
250 |
echo $l_tor_node;
|
|
|
251 |
echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes'>$nb_ip</a></b><br>";
|
|
|
252 |
}
|
|
|
253 |
else
|
|
|
254 |
{
|
|
|
255 |
if(isset($_GET['state']))
|
|
|
256 |
{
|
|
|
257 |
echo "$l_nb_domains <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_domain&titre=domain&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes&state=disable'>$nb_domains</a></b><br>";
|
|
|
258 |
echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes&state=disable'>$nb_ip</a></b><br>";
|
|
|
259 |
}
|
|
|
260 |
else
|
|
|
261 |
{
|
|
|
262 |
echo "$l_nb_domains <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_domain&titre=domain&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes'>$nb_domains</a></b><br>";
|
|
|
263 |
echo "$l_nb_ip <b><a href='?liste=$liste&cat=$categorie&filtre=$filtre_ip&titre=ip&nb_domains=$nb_domains&nb_ip=$nb_ip&ossi=yes'>$nb_ip</a></b><br>";
|
|
|
264 |
}
|
|
|
265 |
}
|
| 1867 |
raphael.pi |
266 |
}
|
| 1332 |
richard |
267 |
?>
|
|
|
268 |
</td></tr>
|
| 318 |
richard |
269 |
</TABLE>
|
|
|
270 |
<br>
|
| 1332 |
richard |
271 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
272 |
<tr><th>
|
|
|
273 |
<?php
|
|
|
274 |
if(isset($_GET["titre"]))
|
|
|
275 |
{
|
|
|
276 |
$titre = $_GET["titre"];
|
|
|
277 |
}
|
|
|
278 |
else
|
|
|
279 |
{
|
|
|
280 |
$titre = "domain";
|
|
|
281 |
}
|
|
|
282 |
echo $l_example.$titre;
|
|
|
283 |
?>
|
|
|
284 |
</th></tr>
|
|
|
285 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
286 |
</TABLE>
|
|
|
287 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
288 |
<tr><td valign="middle" align="left">
|
| 1867 |
raphael.pi |
289 |
<?php
|
| 1332 |
richard |
290 |
if($titre == "domain")
|
|
|
291 |
{
|
| 1867 |
raphael.pi |
292 |
|
|
|
293 |
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
|
| 1332 |
richard |
294 |
exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
|
|
|
295 |
}
|
|
|
296 |
elseif($titre == "ip")
|
|
|
297 |
{
|
| 1867 |
raphael.pi |
298 |
$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
|
| 1332 |
richard |
299 |
exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
|
|
|
300 |
}
|
|
|
301 |
else
|
|
|
302 |
{
|
|
|
303 |
exec("head -n 15 $filtre", $resultat);
|
|
|
304 |
}
|
| 1845 |
raphael.pi |
305 |
for($i=0; $i<count($resultat); $i++)
|
| 1332 |
richard |
306 |
echo $resultat[$i]."<br/>";
|
|
|
307 |
?>
|
|
|
308 |
</td></tr>
|
|
|
309 |
</TABLE>
|
| 318 |
richard |
310 |
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
|
|
|
311 |
</BODY>
|
|
|
312 |
</HTML>
|
| 1899 |
raphael.pi |
313 |
|