Subversion Repositories ALCASAR

Rev

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

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