Subversion Repositories ALCASAR

Rev

Rev 2817 | Rev 3173 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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