Subversion Repositories ALCASAR

Rev

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

Rev 2521 Rev 2688
Line 4... Line 4...
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_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
9
$bl_unbound_dir="/usr/local/share/unbound-bl/";
10
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-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']);
Line 40... Line 40...
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
 
-
 
46
}
45
}
47
if(isset($_GET['cat']))
46
if(isset($_GET['cat']))
48
{
47
{
49
	$categorie = $_GET['cat'];
48
	$categorie = $_GET['cat'];
50
} 
49
}
51
else
50
else
52
{
51
{
53
	$categorie = $l_error_cat;
52
	$categorie = $l_error_cat;
54
}
53
}
55
if(isset($_GET['liste']))
54
if(isset($_GET['liste']))
Line 59... Line 58...
59
else
58
else
60
{
59
{
61
	$liste = $l_error_list;
60
	$liste = $l_error_list;
62
}
61
}
63
if($liste == "bl")
62
if($liste == "bl")
64
	{
63
{
65
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
64
	$bl_categorie_domain_file = $bl_unbound_dir.$categorie.".conf";
66
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
65
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
67
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
66
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
68
	//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)
69
	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']))
70
		{
69
	{
71
		$nb_domains = $_GET['nb_domains'];
70
		$nb_domains = $_GET['nb_domains'];
72
		$nb_urls = $_GET['nb_urls'];
71
		$nb_urls = $_GET['nb_urls'];
73
		$nb_ip = $_GET['nb_ip'];
72
		$nb_ip = $_GET['nb_ip'];
74
		}
73
	}
75
	else
74
	else
76
		{
75
	{
77
		if (file_exists($bl_categorie_domain_file))
76
		if (file_exists($bl_categorie_domain_file))
-
 
77
		{
-
 
78
			# two lines per domain
78
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
79
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1") / 2;
-
 
80
		}
79
		else
81
		else
-
 
82
		{
80
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
83
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
-
 
84
		}
-
 
85
 
81
		if (file_exists($bl_categorie_url_file))
86
		if (file_exists($bl_categorie_url_file))
-
 
87
		{
82
			$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
		}
83
		else
90
		else
-
 
91
		{
84
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
92
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
-
 
93
		}
-
 
94
 
85
		if(file_exists($bl_categorie_ip_file))
95
		if(file_exists($bl_categorie_ip_file))
-
 
96
		{
86
			$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
		}
87
		else
99
		else
-
 
100
		{
88
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
101
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
89
		}
102
		}
90
	}
103
	}
-
 
104
}
91
else
105
else
92
	{
106
{
93
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
107
	$wl_categorie_domain_file = $wl_unbound_dir.$categorie.".conf";
94
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
108
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
95
	if (file_exists($wl_categorie_domain_file))
109
	if (file_exists($wl_categorie_domain_file))
-
 
110
	{
96
		$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
	}
97
	else
113
	else
-
 
114
	{
98
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
115
		$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
-
 
116
	}
-
 
117
 
99
	if (file_exists($wl_categorie_ip_file))
118
	if (file_exists($wl_categorie_ip_file))
-
 
119
	{
100
		$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
	}
101
	else
122
	else
-
 
123
	{
102
		$nb_ip = 0;
124
		$nb_ip = 0;
103
		//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
125
		//$nb_ip = $l_error_open_file." ".$wl_categorie_ip_file;
104
	$nb_urls = 0; //no urls in WL
-
 
105
	}
126
	}
-
 
127
 
-
 
128
	$nb_urls = 0; //no urls in WL
-
 
129
}
106
$global_usage = file($bl_dir."global_usage");
130
$global_usage = file($bl_dir."global_usage");
107
$langue = strtoupper($Language);
131
$langue = strtoupper($Language);
108
if(isset($categorie))
132
if(isset($categorie))
109
{
133
{
110
	$fin1 = 0; $fin2 = 0;
134
	$fin1 = 0; $fin2 = 0;
111
	foreach($global_usage as $line)
135
	foreach($global_usage as $line)
112
	{
136
	{
113
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
137
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
-
 
138
		{
114
			$fin1 = 1;
139
			$fin1 = 1;
-
 
140
		}
115
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
141
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
-
 
142
		{
116
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
143
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
-
 
144
		}
117
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
145
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
118
		{
146
		{
119
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
147
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
120
			$fin2 = 1;
148
			$fin2 = 1;
121
		}
149
		}
Line 176... Line 204...
176
<?php
204
<?php
177
		if($titre == "domain")
205
		if($titre == "domain")
178
		{
206
		{
179
 
207
 
180
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
208
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
181
			exec("head -n 15 ".escapeshellarg($filtre)." | cut -d '/' -f2", $resultat);
209
			exec("head -n 15 ".escapeshellarg($filtre)." | grep 'transparent' | awk '{ print $2 }'", $resultat);
182
		}
210
		}
183
		elseif($titre == "ip")
211
		elseif($titre == "ip")
184
		{
212
		{
185
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
213
			$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
186
			exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat);
214
			exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat);
Line 188... Line 216...
188
		else
216
		else
189
		{
217
		{
190
			exec("head -n 15 ".escapeshellarg($filtre), $resultat);
218
			exec("head -n 15 ".escapeshellarg($filtre), $resultat);
191
		}
219
		}
192
		for($i=0; $i<count($resultat); $i++)
220
		for($i=0; $i<count($resultat); $i++)
-
 
221
		{
193
			echo $resultat[$i]."<br/>";
222
			echo $resultat[$i]."<br/>";
-
 
223
		}
194
		?>
224
		?>
195
	</td></tr>
225
	</td></tr>
196
</TABLE>
226
</TABLE>
197
<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>
198
</BODY>
228
</BODY>
199
</HTML>
229
</HTML>
200
 
-