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/";
|
318 |
richard |
11 |
# Choice of language
|
|
|
12 |
$Language = 'en';
|
1332 |
richard |
13 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
|
|
14 |
{
|
|
|
15 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
16 |
$Language = strtolower(substr(chop($Langue[0]),0,2));
|
318 |
richard |
17 |
}
|
1332 |
richard |
18 |
if($Language == 'fr')
|
|
|
19 |
{
|
|
|
20 |
$l_title = "Catégories de la liste noire";
|
|
|
21 |
$l_error_open_file="Erreur d'ouverture du fichier";
|
|
|
22 |
$l_close="Fermer";
|
|
|
23 |
$l_description_cat="Cette catégorie n'est pas décrite";
|
|
|
24 |
$l_description_ossi="Catégorie personnelle";
|
|
|
25 |
$l_nb_domains="Nombre de noms de domaine filtrés :";
|
|
|
26 |
$l_nb_urls="Nombre d'URL filtrés :";
|
|
|
27 |
$l_nb_ip="Nombre d'IP filtrées :";
|
|
|
28 |
$l_example="Exemple(s) : ";
|
318 |
richard |
29 |
}
|
|
|
30 |
else
|
1332 |
richard |
31 |
{
|
|
|
32 |
$l_title = "Blacklist categories";
|
|
|
33 |
$l_error_open_file="Error opening the file";
|
|
|
34 |
$l_close="Close";
|
|
|
35 |
$l_description_cat="This category isn't describe";
|
|
|
36 |
$l_description_ossi="Personal category";
|
|
|
37 |
$l_nb_domains="Number of filtered domain names :";
|
|
|
38 |
$l_nb_urls="Number of filtered URL :";
|
|
|
39 |
$l_nb_ip="Number of filtered IP :";
|
|
|
40 |
$l_example="Example(s) : ";
|
|
|
41 |
}
|
|
|
42 |
if(isset($_GET['cat']))
|
|
|
43 |
{
|
|
|
44 |
$categorie = $_GET['cat'];
|
|
|
45 |
}
|
|
|
46 |
if(isset($_GET['liste']))
|
|
|
47 |
{
|
|
|
48 |
$liste = $_GET['liste'];
|
|
|
49 |
}
|
|
|
50 |
if($liste == "bl")
|
|
|
51 |
{
|
|
|
52 |
$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
|
|
|
53 |
$bl_categorie_url_file = $bl_dir.$categorie."/urls";
|
|
|
54 |
$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
|
|
|
55 |
if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
|
|
|
56 |
{
|
|
|
57 |
$nb_domains = $_GET['nb_domains'];
|
|
|
58 |
$nb_urls = $_GET['nb_urls'];
|
|
|
59 |
$nb_ip = $_GET['nb_ip'];
|
|
|
60 |
}
|
|
|
61 |
else
|
|
|
62 |
{
|
|
|
63 |
if (file_exists($bl_categorie_domain_file))
|
|
|
64 |
$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
|
|
|
65 |
else
|
|
|
66 |
$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
|
|
|
67 |
if (file_exists($bl_categorie_url_file))
|
|
|
68 |
$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
|
|
|
69 |
else
|
|
|
70 |
$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
|
|
|
71 |
if(file_exists($bl_categorie_ip_file))
|
|
|
72 |
$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
|
|
|
73 |
else
|
|
|
74 |
$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
|
|
|
75 |
}
|
|
|
76 |
}
|
318 |
richard |
77 |
else
|
1332 |
richard |
78 |
{
|
|
|
79 |
$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
|
1377 |
richard |
80 |
$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
|
|
|
81 |
if(isset($_GET['nb_domains']) && isset($_GET['nb_ip']))
|
|
|
82 |
{
|
|
|
83 |
$nb_domains = $_GET['nb_domains'];
|
|
|
84 |
$nb_urls = 0;
|
|
|
85 |
$nb_ip = $_GET['nb_ip'];
|
|
|
86 |
}
|
1332 |
richard |
87 |
else
|
1377 |
richard |
88 |
{
|
|
|
89 |
if (file_exists($wl_categorie_domain_file))
|
|
|
90 |
$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
|
|
|
91 |
else
|
|
|
92 |
$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
|
|
|
93 |
$nb_urls = 0;
|
|
|
94 |
if(file_exists($wl_categorie_ip_file))
|
|
|
95 |
$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
|
|
|
96 |
else
|
|
|
97 |
$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
|
|
|
98 |
}
|
1332 |
richard |
99 |
}
|
1325 |
richard |
100 |
$global_usage = file($bl_dir."global_usage");
|
|
|
101 |
$langue = strtoupper($Language);
|
1332 |
richard |
102 |
if($categorie == "ossi")
|
1325 |
richard |
103 |
{
|
1332 |
richard |
104 |
$l_description_cat = $l_description_ossi;
|
|
|
105 |
}
|
|
|
106 |
else
|
|
|
107 |
{
|
|
|
108 |
for($i=0; $i<count($global_usage); $i++)
|
1325 |
richard |
109 |
{
|
1332 |
richard |
110 |
if(preg_match("#^NAME:.$categorie$#", $global_usage[$i]) == 1)
|
|
|
111 |
{
|
1325 |
richard |
112 |
$i++;
|
1332 |
richard |
113 |
while(preg_match("#^DESC.$langue:#", $global_usage[$i]) == 0)
|
|
|
114 |
$i++;
|
|
|
115 |
$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $global_usage[$i]);
|
|
|
116 |
break;
|
|
|
117 |
}
|
1325 |
richard |
118 |
}
|
|
|
119 |
}
|
318 |
richard |
120 |
echo "<TITLE>$l_title</TITLE>";
|
|
|
121 |
?>
|
|
|
122 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
123 |
</HEAD>
|
|
|
124 |
<body>
|
|
|
125 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
126 |
<tr><th><?php echo $categorie ;?></th></tr>
|
|
|
127 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
128 |
</TABLE>
|
|
|
129 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
1332 |
richard |
130 |
<tr><td valign="middle" align="left">
|
|
|
131 |
<?php
|
|
|
132 |
if(isset($_GET["filtre"]))
|
|
|
133 |
{
|
|
|
134 |
$filtre = $_GET["filtre"];
|
|
|
135 |
}
|
|
|
136 |
else
|
|
|
137 |
{
|
|
|
138 |
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
|
|
|
139 |
}
|
|
|
140 |
$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
|
|
|
141 |
$filtre_url = $liste == "bl" ? $bl_categorie_url_file : $wl_categorie_url_file;
|
|
|
142 |
$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
|
|
|
143 |
$compat_categorie=strtr($categorie,"-","_");
|
|
|
144 |
echo "<br><center><b>$l_description_cat</b></center><br>";
|
|
|
145 |
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>";
|
|
|
146 |
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>";
|
|
|
147 |
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>";
|
|
|
148 |
?>
|
|
|
149 |
</td></tr>
|
318 |
richard |
150 |
</TABLE>
|
|
|
151 |
<br>
|
1332 |
richard |
152 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
153 |
<tr><th>
|
|
|
154 |
<?php
|
|
|
155 |
if(isset($_GET["titre"]))
|
|
|
156 |
{
|
|
|
157 |
$titre = $_GET["titre"];
|
|
|
158 |
}
|
|
|
159 |
else
|
|
|
160 |
{
|
|
|
161 |
$titre = "domain";
|
|
|
162 |
}
|
|
|
163 |
echo $l_example.$titre;
|
|
|
164 |
?>
|
|
|
165 |
</th></tr>
|
|
|
166 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
167 |
</TABLE>
|
|
|
168 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
169 |
<tr><td valign="middle" align="left">
|
|
|
170 |
<?php
|
|
|
171 |
if($titre == "domain")
|
|
|
172 |
{
|
|
|
173 |
exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
|
|
|
174 |
}
|
|
|
175 |
elseif($titre == "ip")
|
|
|
176 |
{
|
|
|
177 |
exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
|
|
|
178 |
}
|
|
|
179 |
else
|
|
|
180 |
{
|
|
|
181 |
exec("head -n 15 $filtre", $resultat);
|
|
|
182 |
}
|
|
|
183 |
for($i=0; $i<15; $i++)
|
|
|
184 |
echo $resultat[$i]."<br/>";
|
|
|
185 |
?>
|
|
|
186 |
</td></tr>
|
|
|
187 |
</TABLE>
|
318 |
richard |
188 |
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
|
|
|
189 |
</BODY>
|
|
|
190 |
</HTML>
|