Subversion Repositories ALCASAR

Rev

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

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