Subversion Repositories ALCASAR

Rev

Rev 1894 | Rev 1903 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
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";
318 richard 32
}
33
else
1332 richard 34
{
35
	$l_title = "Blacklist categories";
36
	$l_error_open_file="Error opening the file";
37
	$l_close="Close";
38
	$l_description_cat="This category isn't describe";
1852 raphael.pi 39
	$l_name_cat ="This category has not name";
1332 richard 40
	$l_nb_domains="Number of filtered domain names :";
41
	$l_nb_urls="Number of filtered URL :";
42
	$l_nb_ip="Number of filtered IP :";
43
	$l_example="Example(s) : ";
1852 raphael.pi 44
	$l_error_cat = "Error category";
45
	$l_error_list = "Error listing";
46
 
1332 richard 47
}
48
if(isset($_GET['cat']))
49
{
50
	$categorie = $_GET['cat'];
51
} 
1852 raphael.pi 52
else
53
{
54
	$categorie = $l_error_cat;
55
}
1332 richard 56
if(isset($_GET['liste']))
57
{
58
	$liste = $_GET['liste'];
59
}
1852 raphael.pi 60
else
61
{
62
	$liste = $l_error_list;
63
}
1332 richard 64
if($liste == "bl")
65
{
1867 raphael.pi 66
	if(isset($ossi))
67
	{
1899 raphael.pi 68
	if(isset($_GET['state']) && $_GET['state']=='disable')
69
	{
70
		$bl_categorie_domain_file = "/usr/local/share/dnsmasq-bl/".$categorie;
71
		$bl_categorie_ip_file = "/usr/local/share/iptables-bl/".$categorie;
72
	}
73
	else
74
	{
75
		$bl_categorie_domain_file = "/usr/local/share/dnsmasq-bl-enabled/".$categorie;
76
		$bl_categorie_ip_file = "/usr/local/share/iptables-bl-enabled/".$categorie;
77
	}
1867 raphael.pi 78
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
79
	{
80
		$nb_domains = $_GET['nb_domains'];
81
		$nb_ip = $_GET['nb_ip'];
82
	}
83
	else
84
	{
85
		if (file_exists($bl_categorie_domain_file))
86
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
87
		else
88
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
89
		if(file_exists($bl_categorie_ip_file))
90
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
91
		else
92
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
93
	}
94
	}
95
	else
96
	{
97
 
98
 
1332 richard 99
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
100
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
101
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
102
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
103
	{
104
		$nb_domains = $_GET['nb_domains'];
105
		$nb_urls = $_GET['nb_urls'];
106
		$nb_ip = $_GET['nb_ip'];
107
	}
108
	else
109
	{
110
		if (file_exists($bl_categorie_domain_file))
111
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
112
		else
113
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
114
		if (file_exists($bl_categorie_url_file))
115
			$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
116
		else
117
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
118
		if(file_exists($bl_categorie_ip_file))
119
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
120
		else
121
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
122
	}
1867 raphael.pi 123
	}
1332 richard 124
}
318 richard 125
else
1332 richard 126
{
1867 raphael.pi 127
 
128
	if(isset($ossi))
129
	{
1899 raphael.pi 130
	if(isset($_GET['state']) && $_GET['state']=='disable')
131
	{
132
		$wl_categorie_domain_file = "/usr/local/share/dnsmasq-wl/".$categorie;
133
		$wl_categorie_ip_file = "/usr/local/share/iptables-wl/".$categorie;
134
	}
135
	else
136
	{
137
		$wl_categorie_domain_file = "/usr/local/share/dnsmasq-wl-enabled/".$categorie;
138
		$wl_categorie_ip_file = "/usr/local/share/iptables-wl-enabled/".$categorie;
139
	}
1867 raphael.pi 140
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
141
	{
142
		$nb_domains = $_GET['nb_domains'];
143
		$nb_ip = $_GET['nb_ip'];
144
	}
145
	else
146
	{
147
		if (file_exists($wl_categorie_domain_file))
148
			$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
149
		else
150
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
151
		if(file_exists($wl_categorie_ip_file))
152
			$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
153
		else
154
			$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
155
	}
156
	}
157
	else
158
	{	
1332 richard 159
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
1377 richard 160
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
1390 richard 161
	if(isset($_GET['nb_domains']))
1377 richard 162
	{
163
		$nb_domains = $_GET['nb_domains'];
164
		$nb_urls = 0;
1390 richard 165
		$nb_ip = 0;
1377 richard 166
	}
1332 richard 167
	else
1377 richard 168
	{
169
		if (file_exists($wl_categorie_domain_file))
170
			$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
171
		else
172
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
173
		$nb_urls = 0;
1390 richard 174
		$nb_ip = 0;
1377 richard 175
	}
1867 raphael.pi 176
	}
1332 richard 177
}
1325 richard 178
$global_usage = file($bl_dir."global_usage");
179
$langue = strtoupper($Language);
1867 raphael.pi 180
if(isset($categorie) && !isset($ossi))
1325 richard 181
{
1852 raphael.pi 182
	$fin1 = 0; $fin2 = 0;
183
	foreach($global_usage as $line)
1325 richard 184
	{
1852 raphael.pi 185
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
186
			$fin1 = 1;
187
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
188
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
189
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
1332 richard 190
		{
1852 raphael.pi 191
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
192
			$fin2 = 1;
1332 richard 193
		}
1852 raphael.pi 194
		if($fin2) break;
195
 
1325 richard 196
	}
197
}
318 richard 198
echo "<TITLE>$l_title</TITLE>";
199
?>
200
<link rel="stylesheet" href="/css/style.css" type="text/css">
201
</HEAD>
202
<body>
203
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
1852 raphael.pi 204
	<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
318 richard 205
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
206
</TABLE>
207
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
1332 richard 208
	<tr><td valign="middle" align="left">
209
		<?php
210
		if(isset($_GET["filtre"]))
211
		{
212
			$filtre = $_GET["filtre"];
213
		}
214
		else
215
		{
216
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
217
		}
218
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
1894 raphael.pi 219
		if(!isset($ossi))
220
			$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
1332 richard 221
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
222
		$compat_categorie=strtr($categorie,"-","_");
1867 raphael.pi 223
		if(!isset($ossi))
224
		{
1852 raphael.pi 225
		echo "<br><center><b>$l_name_cat</b></center>";
226
		echo "<center><b>$l_description_cat</b></center><br>";
1332 richard 227
		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>";
228
		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>";
229
		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 230
		}
231
		else
232
		{
233
 
234
		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>";
235
		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>";
236
		}
1332 richard 237
		?>
238
	</td></tr>
318 richard 239
</TABLE>
240
<br>
1332 richard 241
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
242
	<tr><th>
243
		<?php
244
		if(isset($_GET["titre"]))
245
		{
246
			$titre = $_GET["titre"];
247
		}
248
		else
249
		{
250
			$titre = "domain";
251
		}
252
		echo $l_example.$titre;
253
		?>
254
	</th></tr>
255
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
256
</TABLE>
257
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
258
	<tr><td valign="middle" align="left">
1867 raphael.pi 259
<?php
1332 richard 260
		if($titre == "domain")
261
		{
1867 raphael.pi 262
 
263
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
1332 richard 264
			exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
265
		}
266
		elseif($titre == "ip")
267
		{
1867 raphael.pi 268
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
1332 richard 269
			exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
270
		}
271
		else
272
		{
273
			exec("head -n 15 $filtre", $resultat);
274
		}
1845 raphael.pi 275
		for($i=0; $i<count($resultat); $i++)
1332 richard 276
			echo $resultat[$i]."<br/>";
277
		?>
278
	</td></tr>
279
</TABLE>
318 richard 280
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
281
</BODY>
282
</HTML>
1899 raphael.pi 283