Subversion Repositories ALCASAR

Rev

Rev 1852 | Rev 1874 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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