Subversion Repositories ALCASAR

Rev

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

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