Subversion Repositories ALCASAR

Rev

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

Rev 2853 Rev 3173
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/e2guardian/lists/blacklists/";
6
$bl_dir="/etc/e2guardian/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_unbound_dir="/usr/local/share/unbound-bl/";
9
$bl_unbound_dir="/usr/local/share/unbound-bl/";
10
$wl_unbound_dir="/usr/local/share/unbound-wl/";
10
$wl_unbound_dir="/usr/local/share/unbound-wl/";
11
# Choice of language
11
# Choice of language
12
$Language = 'en';
12
$Language = 'en';
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
14
{
14
{
15
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
	 $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
	 $Language = strtolower(substr(chop($Langue[0]),0,2));
16
	 $Language = strtolower(substr(chop($Langue[0]),0,2));
17
}
17
}
18
if($Language == 'fr')
18
if($Language == 'fr')
19
{
19
{
20
	$l_title = "Catégories de la liste noire";
20
	$l_title = "Catégories de la liste noire";
21
	$l_error_open_file="Erreur d'ouverture du fichier";
21
	$l_error_open_file="Erreur d'ouverture du fichier";
22
	$l_close="Fermer";
22
	$l_close="Fermer";
23
	$l_description_cat="Cette catégorie n'est pas décrite";
23
	$l_description_cat="Cette catégorie n'est pas décrite";
24
	$l_name_cat ="Cette catégorie n'a pas de nom";
24
	$l_name_cat ="Cette catégorie n'a pas de nom";
25
	$l_nb_domains="Nombre de noms de domaine :";
25
	$l_nb_domains="Nombre de noms de domaine :";
26
	$l_nb_urls="Nombre d'URLs :";
26
	$l_nb_urls="Nombre d'URLs :";
27
	$l_nb_ip="Nombre d'adresses IP :";
27
	$l_nb_ip="Nombre d'adresses IP :";
28
	$l_example="Exemple(s) : ";
28
	$l_example="Exemple(s) : ";
29
	$l_error_cat = "Erreur de categorie";
29
	$l_error_cat = "Erreur de categorie";
30
	$l_error_list = "Erreur de listing";
30
	$l_error_list = "Erreur de listing";
31
} else if ($Language == 'es') {
31
} else if ($Language == 'es') {
32
	$l_title = "Categorías de la lista negra";
32
	$l_title = "Categorías de la lista negra";
33
	$l_error_open_file="Error de apertura del archivo";
33
	$l_error_open_file="Error de apertura del archivo";
34
	$l_close="Cerrar";
34
	$l_close="Cerrar";
35
	$l_description_cat="Esta categoría no se describe";
35
	$l_description_cat="Esta categoría no se describe";
36
	$l_name_cat ="Esta categoría no tiene nombre";
36
	$l_name_cat ="Esta categoría no tiene nombre";
37
	$l_nb_domains=" número de nombres de dominio :";
37
	$l_nb_domains=" número de nombres de dominio :";
38
	$l_nb_urls="Número de URLs :";
38
	$l_nb_urls="Número de URLs :";
39
	$l_nb_ip="Número de direcciones IP :";
39
	$l_nb_ip="Número de direcciones IP :";
40
	$l_example="Ejemplo(s) : ";
40
	$l_example="Ejemplo(s) : ";
41
	$l_error_cat = "Error de categoría";
41
	$l_error_cat = "Error de categoría";
42
	$l_error_list = "Error de listado";
42
	$l_error_list = "Error de listado";
43
} else {
43
} else {
44
	$l_title = "Blacklist categories";
44
	$l_title = "Blacklist categories";
45
	$l_error_open_file="Error opening the file";
45
	$l_error_open_file="Error opening the file";
46
	$l_close="Close";
46
	$l_close="Close";
47
	$l_description_cat="This category isn't described";
47
	$l_description_cat="This category isn't described";
48
	$l_name_cat ="This category has no name";
48
	$l_name_cat ="This category has no name";
49
	$l_nb_domains="Number of domain names :";
49
	$l_nb_domains="Number of domain names :";
50
	$l_nb_urls="Number of URLs :";
50
	$l_nb_urls="Number of URLs :";
51
	$l_nb_ip="Number of IP addresses :";
51
	$l_nb_ip="Number of IP addresses :";
52
	$l_example="Example(s) : ";
52
	$l_example="Example(s) : ";
53
	$l_error_cat = "Error category";
53
	$l_error_cat = "Error category";
54
	$l_error_list = "Error listing";
54
	$l_error_list = "Error listing";
55
}
55
}
56
if(isset($_GET['cat']))
56
if(isset($_GET['cat']))
57
{
57
{
58
	$categorie = $_GET['cat'];
58
	$categorie = $_GET['cat'];
59
}
59
}
60
else
60
else
61
{
61
{
62
	$categorie = $l_error_cat;
62
	$categorie = $l_error_cat;
63
}
63
}
64
if(isset($_GET['liste']))
64
if(isset($_GET['liste']))
65
{
65
{
66
	$liste = $_GET['liste'];
66
	$liste = $_GET['liste'];
67
}
67
}
68
else
68
else
69
{
69
{
70
	$liste = $l_error_list;
70
	$liste = $l_error_list;
71
}
71
}
72
if($liste == "bl")
72
if($liste == "bl")
73
{
73
{
74
	$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
74
	$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
75
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
75
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
76
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
76
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
77
	//don't calc again on reload (click on the number of domain/urls/ip)
77
	//don't calc again on reload (click on the number of domain/urls/ip)
78
	if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
78
	if (isset ($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
79
	{
79
	{
80
		$nb_domains = $_GET['nb_domains'];
80
		$nb_domains = $_GET['nb_domains'];
81
		$nb_urls = $_GET['nb_urls'];
81
		$nb_urls = $_GET['nb_urls'];
82
		$nb_ip = $_GET['nb_ip'];
82
		$nb_ip = $_GET['nb_ip'];
83
	}
83
	}
84
	else
84
	else
85
	{
85
	{
86
		if (file_exists($bl_categorie_domain_file))
86
		if (file_exists($bl_categorie_domain_file))
87
		{
87
		{
88
			# two lines per domain
88
			# two lines per domain
89
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2;
89
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2;
90
		}
90
		}
91
		else
91
		else
92
		{
92
		{
93
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
93
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
94
		}
94
		}
95
 
95
 
96
		if (file_exists($bl_categorie_url_file))
96
		if (file_exists($bl_categorie_url_file))
97
		{
97
		{
98
			$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
98
			$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
99
		}
99
		}
100
		else
100
		else
101
		{
101
		{
102
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
102
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
103
		}
103
		}
104
 
104
 
105
		if(file_exists($bl_categorie_ip_file))
105
		if(file_exists($bl_categorie_ip_file))
106
		{
106
		{
107
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
107
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
108
		}
108
		}
109
		else
109
		else
110
		{
110
		{
111
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
111
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
112
		}
112
		}
113
	}
113
	}
114
}
114
}
115
else
115
else
116
{
116
{
117
	$wl_categorie_domain_file = $wl_unbound_dir.$categorie.".conf";
117
	$wl_categorie_domain_file = $wl_unbound_dir.$categorie.".conf";
118
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
118
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
119
	if (file_exists($wl_categorie_domain_file))
119
	if (file_exists($wl_categorie_domain_file))
120
	{
120
	{
121
		$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
121
		$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
122
	}
122
	}
123
	else
123
	else
124
	{
124
	{
125
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
125
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
126
	}
126
	}
127
 
127
 
128
	if (file_exists($wl_categorie_ip_file))
128
	if (file_exists($wl_categorie_ip_file))
129
	{
129
	{
130
		$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
130
		$nb_ip = exec("wc -l $wl_categorie_ip_file | cut -d ' ' -f1");
131
	}
131
	}
132
	else
132
	else
133
	{
133
	{
134
		$nb_ip = 0;
134
		$nb_ip = 0;
135
		//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
135
		//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
136
	}
136
	}
137
 
137
 
138
	$nb_urls = 0; //no urls in WL
138
	$nb_urls = 0; //no urls in WL
139
}
139
}
140
$global_usage = file($bl_dir."global_usage");
140
$global_usage = file($bl_dir."global_usage");
141
$langue = strtoupper($Language);
141
$langue = strtoupper($Language);
142
if(isset($categorie))
142
if(isset($categorie))
143
{
143
{
144
	$fin1 = 0; $fin2 = 0;
144
	$fin1 = 0; $fin2 = 0;
145
	foreach($global_usage as $line)
145
	foreach ($global_usage as $line)
146
	{
146
	{
147
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
147
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
148
		{
148
		{
149
			$fin1 = 1;
149
			$fin1 = 1;
150
		}
150
		}
151
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
151
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
152
		{
152
		{
153
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
153
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
154
		}
154
		}
155
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
155
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
156
		{
156
		{
157
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
157
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
158
			$fin2 = 1;
158
			$fin2 = 1;
159
		}
159
		}
160
		if($fin2) break;
160
		if($fin2) break;
161
	}
161
	}
162
}
162
}
163
echo "<TITLE>$l_title</TITLE>";
163
echo "<TITLE>$l_title</TITLE>";
164
?>
164
?>
165
<link rel="stylesheet" href="/css/acc.css" type="text/css">
165
<link rel="stylesheet" href="/css/acc.css" type="text/css">
166
</HEAD>
166
</HEAD>
167
<body>
167
<body>
168
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
168
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
169
	<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
169
	<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
170
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
170
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
171
</TABLE>
171
</TABLE>
172
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
172
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
173
	<tr><td valign="middle" align="left">
173
	<tr><td valign="middle" align="left">
174
		<?php
174
		<?php
175
		if(isset($_GET["filtre"]))
175
		if(isset($_GET["filtre"]))
176
		{
176
		{
177
			$filtre = $_GET["filtre"];
177
			$filtre = $_GET["filtre"];
178
		}
178
		}
179
		else
179
		else
180
		{
180
		{
181
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
181
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
182
		}
182
		}
183
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
183
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
184
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
184
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
185
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
185
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
186
		$compat_categorie=strtr($categorie,"-","_");
186
		$compat_categorie=strtr($categorie,"-","_");
187
		echo "<br><center><b>$l_name_cat</b></center>";
187
		echo "<br><center><b>$l_name_cat</b></center>";
188
		echo "<center><b>$l_description_cat</b></center><br>";
188
		echo "<center><b>$l_description_cat</b></center><br>";
189
		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>";
189
		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>";
190
		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>";
190
		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>";
191
		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>";
191
		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>";
192
		?>
192
		?>
193
	</td></tr>
193
	</td></tr>
194
</TABLE>
194
</TABLE>
195
<br>
195
<br>
196
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
196
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
197
	<tr><th>
197
	<tr><th>
198
		<?php
198
		<?php
199
		if(isset($_GET["titre"]))
199
		if(isset($_GET["titre"]))
200
		{
200
		{
201
			$titre = $_GET["titre"];
201
			$titre = $_GET["titre"];
202
		}
202
		}
203
		else
203
		else
204
		{
204
		{
205
			$titre = "domain";
205
			$titre = "domain";
206
		}
206
		}
207
		echo $l_example.$titre;
207
		echo $l_example.$titre;
208
		?>
208
		?>
209
	</th></tr>
209
	</th></tr>
210
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
210
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
211
</TABLE>
211
</TABLE>
212
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
212
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
213
	<tr><td valign="middle" align="left">
213
	<tr><td valign="middle" align="left">
214
<?php
214
<?php
215
		if($titre == "domain")
215
		if($titre == "domain")
216
		{
216
		{
217
 
217
 
218
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
218
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
219
			exec("head -n 15 ".escapeshellarg($filtre)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
219
			exec("head -n 15 ".escapeshellarg($filtre)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
220
		}
220
		}
221
		elseif($titre == "ip")
221
		elseif($titre == "ip")
222
		{
222
		{
223
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
223
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
224
			exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat);
224
			exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat);
225
		}
225
		}
226
		else
226
		else
227
		{
227
		{
228
			exec("head -n 15 ".escapeshellarg($filtre), $resultat);
228
			exec("head -n 15 ".escapeshellarg($filtre), $resultat);
229
		}
229
		}
230
		for($i=0; $i<count($resultat); $i++)
230
		for($i=0; $i<count($resultat); $i++)
231
		{
231
		{
232
			echo $resultat[$i]."<br/>";
232
			echo $resultat[$i]."<br/>";
233
		}
233
		}
234
		?>
234
		?>
235
	</td></tr>
235
	</td></tr>
236
</TABLE>
236
</TABLE>
237
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
237
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
238
</BODY>
238
</BODY>
239
</HTML>
239
</HTML>
240
 
240