Subversion Repositories ALCASAR

Rev

Rev 1845 | Rev 1867 | 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
<?
6
$bl_dir="/etc/dansguardian/lists/blacklists/";
1332 richard 7
$bl_iptables_dir="/usr/local/share/iptables-bl/";
1377 richard 8
$wl_iptables_dir="/usr/local/share/iptables-wl/";
1332 richard 9
$bl_dnsmasq_dir="/usr/local/share/dnsmasq-bl/";
10
$wl_dnsmasq_dir="/usr/local/share/dnsmasq-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";
25
	$l_nb_domains="Nombre de noms de domaine filtrés :";
26
	$l_nb_urls="Nombre d'URL filtrés :";
27
	$l_nb_ip="Nombre d'IP filtrées :";
28
	$l_example="Exemple(s) : ";
29
	$l_error_cat = "Erreur de categorie";
30
	$l_error_list = "Erreur de listing";
318 richard 31
}
32
else
1332 richard 33
{
34
	$l_title = "Blacklist categories";
35
	$l_error_open_file="Error opening the file";
36
	$l_close="Close";
37
	$l_description_cat="This category isn't describe";
1852 raphael.pi 38
	$l_name_cat ="This category has not name";
1332 richard 39
	$l_nb_domains="Number of filtered domain names :";
40
	$l_nb_urls="Number of filtered URL :";
41
	$l_nb_ip="Number of filtered IP :";
42
	$l_example="Example(s) : ";
1852 raphael.pi 43
	$l_error_cat = "Error category";
44
	$l_error_list = "Error listing";
45
 
1332 richard 46
}
47
if(isset($_GET['cat']))
48
{
49
	$categorie = $_GET['cat'];
50
} 
1852 raphael.pi 51
else
52
{
53
	$categorie = $l_error_cat;
54
}
1332 richard 55
if(isset($_GET['liste']))
56
{
57
	$liste = $_GET['liste'];
58
}
1852 raphael.pi 59
else
60
{
61
	$liste = $l_error_list;
62
}
1332 richard 63
if($liste == "bl")
64
{
65
	$bl_categorie_domain_file = $bl_dnsmasq_dir.$categorie.".conf";
66
	$bl_categorie_url_file = $bl_dir.$categorie."/urls";
67
	$bl_categorie_ip_file = $bl_iptables_dir.$categorie;
68
	if(isset($_GET['nb_domains']) && isset($_GET['nb_urls']) && isset($_GET['nb_ip']))
69
	{
70
		$nb_domains = $_GET['nb_domains'];
71
		$nb_urls = $_GET['nb_urls'];
72
		$nb_ip = $_GET['nb_ip'];
73
	}
74
	else
75
	{
76
		if (file_exists($bl_categorie_domain_file))
77
			$nb_domains = exec("wc -l $bl_categorie_domain_file | cut -d ' ' -f1");
78
		else
79
			$nb_domains = $l_error_open_file." ".$bl_categorie_domain_file;
80
		if (file_exists($bl_categorie_url_file))
81
			$nb_urls = exec ("wc -l $bl_categorie_url_file | cut -d ' ' -f1");
82
		else
83
			$nb_urls = $l_error_open_file." ".$bl_categorie_url_file;
84
		if(file_exists($bl_categorie_ip_file))
85
			$nb_ip = exec("wc -l $bl_categorie_ip_file | cut -d ' ' -f1");
86
		else
87
			$nb_ip = $l_error_open_file." ".$bl_categorie_ip_file;
88
	}
89
}
318 richard 90
else
1332 richard 91
{
92
	$wl_categorie_domain_file = $wl_dnsmasq_dir.$categorie.".conf";
1377 richard 93
	$wl_categorie_ip_file = $wl_iptables_dir.$categorie;
1390 richard 94
	if(isset($_GET['nb_domains']))
1377 richard 95
	{
96
		$nb_domains = $_GET['nb_domains'];
97
		$nb_urls = 0;
1390 richard 98
		$nb_ip = 0;
1377 richard 99
	}
1332 richard 100
	else
1377 richard 101
	{
102
		if (file_exists($wl_categorie_domain_file))
103
			$nb_domains = exec("wc -l $wl_categorie_domain_file | cut -d ' ' -f1");
104
		else
105
			$nb_domains = $l_error_open_file." ".$wl_categorie_domain_file;
106
		$nb_urls = 0;
1390 richard 107
		$nb_ip = 0;
1377 richard 108
	}
1332 richard 109
}
1325 richard 110
$global_usage = file($bl_dir."global_usage");
111
$langue = strtoupper($Language);
1852 raphael.pi 112
if(isset($categorie))
1325 richard 113
{
1852 raphael.pi 114
	$fin1 = 0; $fin2 = 0;
115
	foreach($global_usage as $line)
1325 richard 116
	{
1852 raphael.pi 117
		if(preg_match("#^NAME:.$categorie$#", $line) == 1)
118
			$fin1 = 1;
119
		if($fin1 && preg_match("#^DESC.$langue:.#", $line) == 1)
120
			$l_description_cat = preg_replace("#^DESC.$langue:.#", "", $line);
121
		if($fin1 && preg_match("#^NAME.$langue:.#", $line) == 1)
1332 richard 122
		{
1852 raphael.pi 123
			$l_name_cat = preg_replace("#^NAME.$langue:.#", "", $line);
124
			$fin2 = 1;
1332 richard 125
		}
1852 raphael.pi 126
		if($fin2) break;
127
 
1325 richard 128
	}
129
}
318 richard 130
echo "<TITLE>$l_title</TITLE>";
131
?>
132
<link rel="stylesheet" href="/css/style.css" type="text/css">
133
</HEAD>
134
<body>
135
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
1852 raphael.pi 136
	<tr><th><?php if(isset($categorie)){echo $categorie ;}else{echo $l_error_cat;}?></th></tr>
318 richard 137
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
138
</TABLE>
139
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
1332 richard 140
	<tr><td valign="middle" align="left">
141
		<?php
142
		if(isset($_GET["filtre"]))
143
		{
144
			$filtre = $_GET["filtre"];
145
		}
146
		else
147
		{
148
			$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
149
		}
150
		$filtre_domain = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file;
1852 raphael.pi 151
		$filtre_url = $liste == "bl" ? $bl_categorie_url_file : "";
1332 richard 152
		$filtre_ip = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file;
153
		$compat_categorie=strtr($categorie,"-","_");
1852 raphael.pi 154
		echo "<br><center><b>$l_name_cat</b></center>";
155
		echo "<center><b>$l_description_cat</b></center><br>";
1332 richard 156
		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>";
157
		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>";
158
		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>";
159
		?>
160
	</td></tr>
318 richard 161
</TABLE>
162
<br>
1332 richard 163
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
164
	<tr><th>
165
		<?php
166
		if(isset($_GET["titre"]))
167
		{
168
			$titre = $_GET["titre"];
169
		}
170
		else
171
		{
172
			$titre = "domain";
173
		}
174
		echo $l_example.$titre;
175
		?>
176
	</th></tr>
177
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
178
</TABLE>
179
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
180
	<tr><td valign="middle" align="left">
181
		<?php
182
		if($titre == "domain")
183
		{
184
			exec("head -n 15 $filtre | cut -d '/' -f2", $resultat);
185
		}
186
		elseif($titre == "ip")
187
		{
188
			exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat);
189
		}
190
		else
191
		{
192
			exec("head -n 15 $filtre", $resultat);
193
		}
1845 raphael.pi 194
		for($i=0; $i<count($resultat); $i++)
1332 richard 195
			echo $resultat[$i]."<br/>";
196
		?>
197
	</td></tr>
198
</TABLE>
318 richard 199
<center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
200
</BODY>
201
</HTML>