Subversion Repositories ALCASAR

Rev

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

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