Subversion Repositories ALCASAR

Rev

Rev 1904 | Rev 1955 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1904 Rev 1936
Line 6... Line 6...
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'];
-
 
12
# Choice of language
11
# Choice of language
13
$Language = 'en';
12
$Language = 'en';
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
15
{
14
{
16
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
Line 27... Line 26...
27
	$l_nb_urls="Nombre d'URL filtrés :";
26
	$l_nb_urls="Nombre d'URL filtrés :";
28
	$l_nb_ip="Nombre d'IP filtrées :";
27
	$l_nb_ip="Nombre d'IP filtrées :";
29
	$l_example="Exemple(s) : ";
28
	$l_example="Exemple(s) : ";
30
	$l_error_cat = "Erreur de categorie";
29
	$l_error_cat = "Erreur de categorie";
31
	$l_error_list = "Erreur de listing";
30
	$l_error_list = "Erreur de listing";
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>";
-
 
33
}
31
}
34
else
32
else
35
{
33
{
36
	$l_title = "Blacklist categories";
34
	$l_title = "Blacklist categories";
37
	$l_error_open_file="Error opening the file";
35
	$l_error_open_file="Error opening the file";
38
	$l_close="Close";
36
	$l_close="Close";
39
	$l_description_cat="This category isn't describe";
37
	$l_description_cat="This category isn't described";
40
	$l_name_cat ="This category has not name";
38
	$l_name_cat ="This category has no name";
41
	$l_nb_domains="Number of filtered domain names :";
39
	$l_nb_domains="Number of filtered domain names :";
42
	$l_nb_urls="Number of filtered URL :";
40
	$l_nb_urls="Number of filtered URL :";
43
	$l_nb_ip="Number of filtered IP :";
41
	$l_nb_ip="Number of filtered IP :";
44
	$l_example="Example(s) : ";
42
	$l_example="Example(s) : ";
45
	$l_error_cat = "Error category";
43
	$l_error_cat = "Error category";
46
	$l_error_list = "Error listing";
44
	$l_error_list = "Error listing";
47
	$l_tor_node = "This list is Tor's nodes. If you enable this list, users won't reach Tor network.</br> ";
-
 
48
 
45
 
49
}
46
}
50
if(isset($_GET['cat']))
47
if(isset($_GET['cat']))
51
{
48
{
52
	$categorie = $_GET['cat'];
49
	$categorie = $_GET['cat'];
Line 62... Line 59...
62
else
59
else
63
{
60
{
64
	$liste = $l_error_list;
61
	$liste = $l_error_list;
65
}
62
}
66
if($liste == "bl")
63
if($liste == "bl")
67
{
-
 
68
	if(isset($ossi))
-
 
69
	{
-
 
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
	{
64
	{
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
	}
-
 
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))
-
 
88
		{
-
 
89
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
-
 
90
		}
-
 
91
		else
-
 
92
		{
-
 
93
			if($categorie!='ossi-tor_node_ip')
-
 
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
		}
-
 
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
	
-
 
113
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
65
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
114
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
66
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
115
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
67
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
-
 
68
	//don't calc again on reload (click on the number of domain/urls/ip)
116
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
69
	if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
117
	{
70
		{
118
		$nb_domains = $_GET['nb_domains'];
71
		$nb_domains = $_GET['nb_domains'];
119
		$nb_urls = $_GET['nb_urls'];
72
		$nb_urls = $_GET['nb_urls'];
120
		$nb_ip = $_GET['nb_ip'];
73
		$nb_ip = $_GET['nb_ip'];
121
	}
74
		}
122
	else
75
	else
123
	{
76
		{
124
		if (file_exists($bl_categorie_domain_file))
77
		if (file_exists($bl_categorie_domain_file))
125
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
78
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
126
		else
79
		else
127
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
80
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
128
		if (file_exists($bl_categorie_url_file))
81
		if (file_exists($bl_categorie_url_file))
Line 131... Line 84...
131
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
84
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
132
		if(file_exists($bl_categorie_ip_file))
85
		if(file_exists($bl_categorie_ip_file))
133
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
86
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
134
		else
87
		else
135
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
88
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
-
 
89
		}
136
	}
90
	}
137
	}
-
 
138
}
-
 
139
else
91
else
140
{
-
 
141
	
-
 
142
	if(isset($ossi))
-
 
143
	{
-
 
144
	if(isset($_GET['state']) && $_GET['state']=='disable')
-
 
145
	{
92
	{
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
	}
-
 
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
	{	
-
 
173
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
93
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
174
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
94
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
175
	if(isset($_GET['nb_domains']))
95
	if (file_exists($wl_categorie_domain_file))
176
	{
-
 
177
		$nb_domains = $_GET['nb_domains'];
96
		$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
178
		$nb_urls = 0;
-
 
179
		$nb_ip = 0;
-
 
180
	}
-
 
181
	else
97
	else
182
	{
-
 
-
 
98
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
183
		if (file_exists($wl_categorie_domain_file))
99
	if (file_exists($wl_categorie_ip_file))
184
			$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
100
		$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
185
		else
101
	else
186
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
102
		$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
187
		$nb_urls = 0;
103
	$nb_urls = 0; //no urls in WL
188
		$nb_ip = 0;
-
 
189
	}
-
 
190
	}
104
	}
191
}
-
 
192
$global_usage = file($bl_dir."global_usage");
105
$global_usage = file($bl_dir."global_usage");
193
$langue = strtoupper($Language);
106
$langue = strtoupper($Language);
194
if(isset($categorie) && !isset($ossi))
107
if(isset($categorie))
195
{
108
{
196
	$fin1 = 0; $fin2 = 0;
109
	$fin1 = 0; $fin2 = 0;
197
	foreach($global_usage as $line)
110
	foreach($global_usage as $line)
198
	{
111
	{
199
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
112
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
Line 204... Line 117...
204
		{
117
		{
205
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
118
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
206
			$fin2 = 1;
119
			$fin2 = 1;
207
		}
120
		}
208
		if($fin2) break;
121
		if($fin2) break;
209
		
-
 
210
	}
122
	}
211
}
123
}
212
echo "<TITLE>$l_title</TITLE>";
124
echo "<TITLE>$l_title</TITLE>";
213
?>
125
?>
214
<link rel="stylesheet" href="/css/style.css" type="text/css">
126
<link rel="stylesheet" href="/css/style.css" type="text/css">
Line 227... Line 139...
227
		}
139
		}
228
		else
140
		else
229
		{
141
		{
230
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
142
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
231
		}
143
		}
232
		if($categorie!='ossi-tor_node_ip')
-
 
233
			$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
144
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
234
		if(!isset($ossi))
-
 
235
			$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
-
 
236
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
145
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
-
 
146
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
237
		$compat_categorie=strtr($categorie,"-","_");
147
		$compat_categorie=strtr($categorie,"-","_");
238
		if(!isset($ossi))
-
 
239
		{
-
 
240
		echo "<br><center><b>$l_name_cat</b></center>";
148
		echo "<br><center><b>$l_name_cat</b></center>";
241
		echo "<center><b>$l_description_cat</b></center><br>";
149
		echo "<center><b>$l_description_cat</b></center><br>";
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>";
150
		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>";
151
		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>";
152
		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>";
245
		}
-
 
246
		else
-
 
247
		{
-
 
248
			if($categorie=='ossi-tor_node_ip')
-
 
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
			}
-
 
266
		}
-
 
267
		?>
153
		?>
268
	</td></tr>
154
	</td></tr>
269
</TABLE>
155
</TABLE>
270
<br>
156
<br>
271
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
157
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">