Subversion Repositories ALCASAR

Rev

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

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