Subversion Repositories ALCASAR

Rev

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

Rev 2688 Rev 2769
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
<TITLE>ALCASAR DNS BL filtering</TITLE>
5
<TITLE>ALCASAR DNS BL filtering</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<?
9
<?
10
function form_filter ($form_content)
10
function form_filter ($form_content)
11
{
11
{
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
12
// réencodage iso + format unix + rc fin de ligne (ouf...)
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
13
	$list = str_replace("\r\n", "\n", utf8_decode($form_content));
14
	if (strlen($list) != 0){
14
	if (strlen($list) != 0){
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
15
		if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
16
	return $list;
16
	return $list;
17
}
17
}
18
function form_filter_ip($form_content, $color)
18
function form_filter_ip($form_content, $color)
19
{
19
{
20
	//# reconstruction des ip
20
	//# reconstruction des ip
21
	$list = explode("\n", form_filter($form_content));
21
	$list = explode("\n", form_filter($form_content));
22
	$new_list = "";
22
	$new_list = "";
23
	foreach($list as &$value)
23
	foreach($list as &$value)
24
	{
24
	{
25
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
25
		if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
26
		{
26
		{
27
			$new_list = $new_list.$value."\n";
27
			$new_list = $new_list.$value."\n";
28
		}
28
		}
29
	}
29
	}
30
	if($color == "white")
30
	if($color == "white")
31
	{
31
	{
32
		return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
32
		return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list);
33
	}
33
	}
34
	else
34
	else
35
	{
35
	{
36
		return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
36
		return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list);
37
	}
37
	}
38
}
38
}
39
function echo_file ($filename)
39
function echo_file ($filename)
40
{
40
{
41
	if (file_exists($filename))
41
	if (file_exists($filename))
42
	{
42
	{
43
		if (filesize($filename) != 0)
43
		if (filesize($filename) != 0)
44
		{
44
		{
45
			$pointeur=fopen($filename,"r");
45
			$pointeur=fopen($filename,"r");
46
			$tampon = fread($pointeur, filesize($filename));
46
			$tampon = fread($pointeur, filesize($filename));
47
			fclose($pointeur);
47
			fclose($pointeur);
48
			echo $tampon;
48
			echo $tampon;
49
		}
49
		}
50
	}
50
	}
51
	else
51
	else
52
	{
52
	{
53
		echo "$filename doesn't exist";
53
		echo "$filename doesn't exist";
54
	}
54
	}
55
}
55
}
56
function echo_ip_file ($filename)
56
function echo_ip_file ($filename)
57
{
57
{
58
	$filename = escapeshellarg($filename);
58
	$filename = escapeshellarg($filename);
59
	exec("cat $filename | cut -d ' ' -f3", $resultat);
59
	exec("cat $filename | cut -d ' ' -f3", $resultat);
60
	for($i=0; $i<exec("wc -l $filename"); $i++)
60
	for($i=0; $i<exec("wc -l $filename"); $i++)
61
	{
61
	{
62
		echo $resultat[$i]."\n";
62
		echo $resultat[$i]."\n";
63
	}
63
	}
64
}
64
}
65
 
65
 
66
# Choice of language
66
# Choice of language
67
$Language = 'en';
67
$Language = 'en';
68
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
68
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
69
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
69
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
70
	$Language = strtolower(substr(chop($Langue[0]),0,2));
70
	$Language = strtolower(substr(chop($Langue[0]),0,2));
71
}
71
}
72
if($Language == 'fr'){
72
if($Language == 'fr'){
73
	$l_bl="Liste noire générale";
73
	$l_bl="Liste noire principale";
74
	$l_load="Chargement...";
74
	$l_load="Chargement...";
75
	$l_list_version="Version de la liste : ";
75
	$l_list_version="Version de la liste : ";
76
	$l_bl_categories="Sélectionnez les catégories à filtrer";
76
	$l_bl_categories="Sélectionnez les catégories à filtrer";
77
	$l_download_bl="Télécharger la dernière version";
77
	$l_download_bl="Télécharger la dernière version";
78
	$l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
78
	$l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
79
	$l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
79
	$l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
80
	$l_activate_bl="Activer la nouvelle version";
80
	$l_activate_bl="Activer la nouvelle version";
81
	$l_reject_bl="Rejeter";
81
	$l_reject_bl="Rejeter";
82
	$l_warning="Temps estimé : une minute";
82
	$l_warning="Temps estimé : une minute";
83
	$l_specific_filtering="Filtrage special";
83
	$l_specific_filtering="Filtrage special";
84
	$l_maj_rehabilitated="Noms de domaine ou adresses IP réhabilités";
84
	$l_maj_rehabilitated="Noms de domaine ou adresses IP réhabilités";
85
	$l_rehabilitated_dns="Noms de domaine réhabilités";
85
	$l_rehabilitated_dns="Noms de domaine réhabilités";
86
	$l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
86
	$l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
87
	$l_add_to_bl="Noms de domaine ou adresses IP à ajouter à la liste noire";
87
	$l_add_to_bl="Noms de domaine ou adresses IP à ajouter à la liste noire";
88
	$l_rehabilitated_ip="Adresses IP réhabilitées";
88
	$l_rehabilitated_ip="Adresses IP réhabilitées";
89
	$l_rehabilitated_ip_explain="Entrez ici des IP bloquées par la liste noire <BR> que vous souhaitez réhabiliter.";
89
	$l_rehabilitated_ip_explain="Entrez ici des IP bloquées par la liste noire <BR> que vous souhaitez réhabiliter.";
90
	$l_one_dns="Entrez une adresse DNS par ligne (exemple : www.domaine.com)";
90
	$l_one_dns="Entrez une adresse DNS par ligne (exemple : www.domaine.com)";
91
	$l_one_ip="Entrez une IP par ligne (exemple : 123.123.123.123)";
91
	$l_one_ip="Entrez une IP par ligne (exemple : 123.123.123.123)";
92
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : domaine.org. - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
92
	$l_one_dns_ip="Entrez un nom de domaine ou une adresse IP ou une adresse de réseau par ligne<br>exemple (domaine) : domaine.org. - exemple (ip) : 61.54.52.56 - exemple (réseau) : 172.16.0.0/16";
93
	$l_record="Enregistrer les modifications";
93
	$l_record="Enregistrer les modifications";
94
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
94
	$l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
95
	$l_ip_filtering="Filtrer les URLs contenant une adresse IP au lieu d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
95
	$l_ip_filtering="Filtrer les URLs contenant une adresse IP au lieu d'un nom de domaine (ex: http://25.56.58.59/index.htm)";
96
	$l_safe_searching="Activer le contrôle scolaire/parental pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
96
	$l_safe_searching="Activer le contrôle scolaire/parental pour 'YouTube' et pour les moteurs de recherche 'Google', 'Bing' et 'Qwant'.";
97
	$l_error_open_file="Erreur d'ouverture du fichier";
97
	$l_error_open_file="Erreur d'ouverture du fichier";
98
	$l_additional_file_title="Fichiers de 'listes noires' additionnels";
98
	$l_additional_file_title="Listes noires additionnelles";
99
	$l_file_list="Liste des fichiers";
99
	$l_file_list="Liste des fichiers";
100
	$l_add_file="Ajouter un fichier";
100
	$l_add_file="Ajouter un fichier";
101
	$l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine";
101
	$l_add_file_explain="Chaque ligne du fichier doit être une adresse IP ou un nom de domaine";
102
	$l_file_name="Nom du fichier";
102
	$l_file_name="Nom du fichier";
103
	$l_file_action="Action";
103
	$l_file_action="Action";
104
	$l_error_upload="Erreur d'envoi du fichier";
104
	$l_error_upload="Erreur d'envoi du fichier";
105
	$l_remove="Supprimer";
105
	$l_remove="Supprimer";
106
	$l_submit="Envoyer";
106
	$l_submit="Envoyer";
107
	$l_nb_ip="Nombre d'IP";
107
	$l_nb_ip="Nombre d'IP";
108
	$l_nb_domain_names="Nombre de noms de domaine";
108
	$l_nb_domain_names="Nombre de noms de domaine";
109
	$l_nbDomainNames="Noms de domaine :";
109
	$l_nbDomainNames="Noms de domaine :";
110
	$l_nbUrl="Url :";
110
	$l_nbUrl="Url :";
111
	$l_nbIp="Ip :";
111
	$l_nbIp="Ip :";
112
	$l_update_cat="Mise a jour des catégories automatiquement toutes les 12h (seulement 'malware' actuellement)?";
112
	$l_update_cat="Blacklist principale (catégorie 'malware' uniquement)";
-
 
113
	$l_update_cat_header="Mise à jour automatique des Blacklists";
-
 
114
	$l_update_success="Mise à jour ratée";
-
 
115
	$l_update_failed="Mise à jour réussie";
113
	$l_disable="Désactiver";
116
	$l_disable="Désactiver";
114
	$l_enable="Activer";
117
	$l_enable="Activer";
-
 
118
	$l_update="Mise a jour";
-
 
119
	$l_no_update_configured="Aucun script de mise à jour trouvée";
115
	$l_file_state="Etat";
120
	$l_file_state="Etat";
116
}
121
}
117
else {
122
else {
118
	$l_bl="General BlackList";
123
	$l_bl="Main BlackList";
119
	$l_load="Loading...";
124
	$l_load="Loading...";
120
	$l_list_version="List version : ";
125
	$l_list_version="List version : ";
121
	$l_bl_categories="Select the categories to filter";
126
	$l_bl_categories="Select the categories to filter";
122
	$l_download_bl="Download the last version";
127
	$l_download_bl="Download the last version";
123
	$l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
128
	$l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
124
	$l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
129
	$l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
125
	$l_activate_bl="Activate the new version";
130
	$l_activate_bl="Activate the new version";
126
	$l_reject_bl="Reject";
131
	$l_reject_bl="Reject";
127
	$l_warning="Estimated time : one minute";
132
	$l_warning="Estimated time : one minute";
128
	$l_specific_filtering="Specific filtering";
133
	$l_specific_filtering="Specific filtering";
129
	$l_allowed_dns="Allowed domain names";
134
	$l_allowed_dns="Allowed domain names";
130
	$l_maj_rehabilitated="Domain names or IP addresses to rehabilitated";
135
	$l_maj_rehabilitated="Domain names or IP addresses to rehabilitated";
131
	$l_rehabilitated_dns="Domain names to rehabilitated";
136
	$l_rehabilitated_dns="Domain names to rehabilitated";
132
	$l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
137
	$l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
133
	$l_add_to_bl="Domain names or IP addresses to add to the blacklist";
138
	$l_add_to_bl="Domain names or IP addresses to add to the blacklist";
134
	$l_rehabilitated_ip="IP addresses to rehabilitated";
139
	$l_rehabilitated_ip="IP addresses to rehabilitated";
135
	$l_rehabilitated_ip_explain="Enter here IP that are blocked by the blacklist <BR> and you want to rehabilitate.";
140
	$l_rehabilitated_ip_explain="Enter here IP that are blocked by the blacklist <BR> and you want to rehabilitate.";
136
	$l_one_dns="Enter one DNS per row (example : www.domain.com)";
141
	$l_one_dns="Enter one DNS per row (example : www.domain.com)";
137
	$l_one_ip="Enter one IP per row (example : 123.123.123.123)";
142
	$l_one_ip="Enter one IP per row (example : 123.123.123.123)";
138
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): domain.org. - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
143
	$l_one_dns_ip="Enter one domain name or one IP address or one network address per row <br>example (domain): domain.org. - example (ip): 61.54.56.52 - example (network) : 172.16.0.0/16";
139
	$l_record="Save changes";
144
	$l_record="Save changes";
140
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
145
	$l_wait="Once validated, 10 seconds are necessary to compute your modifications";
141
	$l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
146
	$l_ip_filtering="Filtering URLs that contain an IP address instead of a domain name (ie: http://25.56.58.59/index.htm)";
142
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
147
	$l_safe_searching="Enabling school/parental control for 'YouTube' and for the search engines 'Google', 'Bing' and 'Qwant'";
143
	$l_error_open_file="Error opening file";
148
	$l_error_open_file="Error opening file";
144
	$l_additional_file_title="Additional blacklist files";
149
	$l_additional_file_title="Additional blacklists";
145
	$l_file_list="Files list";
150
	$l_file_list="Files list";
146
	$l_add_file="Add a file";
151
	$l_add_file="Add a file";
147
	$l_add_file_explain="Each line of the file must be an IP address or a domain name";
152
	$l_add_file_explain="Each line of the file must be an IP address or a domain name";
148
	$l_file_name="Filename";
153
	$l_file_name="Filename";
149
	$l_file_action="Action";
154
	$l_file_action="Action";
150
	$l_error_upload="Error during the upload process";
155
	$l_error_upload="Error during the upload process";
151
	$l_remove="Delete";
156
	$l_remove="Delete";
152
	$l_submit="Submit";
157
	$l_submit="Submit";
153
	$l_nb_ip="Number of IP";
158
	$l_nb_ip="Number of IP";
154
	$l_nb_domain_names="Number of domain names";
159
	$l_nb_domain_names="Number of domain names";
155
	$l_nbDomainNames="Domain names :";
160
	$l_nbDomainNames="Domain names :";
156
	$l_nbUrl="Url :";
161
	$l_nbUrl="Url :";
157
	$l_nbIp="Ip :";
162
	$l_nbIp="Ip :";
158
	$l_update_cat="Update automaticly categories every 12 hours (only 'malware' for now)?";
163
	$l_update_cat="Main Blacklist (only 'malware' category)";
-
 
164
	$l_update_cat_header="Automatic Update of Blacklists";
-
 
165
	$l_update_success="Update succeeded";
-
 
166
	$l_update_failed="Update failed";
159
	$l_disable="Disable";
167
	$l_disable="Disable";
160
	$l_enable="Enable";
168
	$l_enable="Enable";
-
 
169
	$l_update="Update";
-
 
170
	$l_no_update_configured="No update script configured";
161
	$l_file_state="State";
171
	$l_file_state="State";
162
}
172
}
163
$dir_etc="/usr/local/etc/";
173
$dir_etc="/usr/local/etc/";
164
$dir_dg="/etc/e2guardian/lists/";
174
$dir_dg="/etc/e2guardian/lists/";
165
$dir_blacklist=$dir_dg."blacklists/";
175
$dir_blacklist=$dir_dg."blacklists/";
166
$dir_bl_ip="/usr/local/share/iptables-bl/";
176
$dir_bl_ip="/usr/local/share/iptables-bl/";
167
$dir_bl_ip_enabled="/usr/local/share/iptables-bl-enabled/";
177
$dir_bl_ip_enabled="/usr/local/share/iptables-bl-enabled/";
168
$dir_bl_domain_names="/usr/local/share/unbound-bl/";
178
$dir_bl_domain_names="/usr/local/share/unbound-bl/";
169
$dir_bl_domain_names_enabled="/usr/local/share/unbound-bl-enabled/";
179
$dir_bl_domain_names_enabled="/usr/local/share/unbound-bl-enabled/";
170
$bl_categories=$dir_etc."alcasar-bl-categories";
180
$bl_categories=$dir_etc."alcasar-bl-categories";
171
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
181
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
172
$conf_file=$dir_etc."alcasar.conf";
182
$conf_file=$dir_etc."alcasar.conf";
173
$domainfilter_file="/etc/unbound/conf.d/blacklist/domainfilter.conf";
183
$domainfilter_file="/etc/unbound/conf.d/blacklist/domainfilter.conf";
174
$bannedsite_file=$dir_dg."bannedsitelist";
184
$bannedsite_file=$dir_dg."bannedsitelist";
175
$dir_tmp="/tmp/blacklists";
185
$dir_tmp="/tmp/blacklists";
176
$update_file_cat="/usr/local/etc/update_cat.conf";
186
$update_file_cat="/usr/local/etc/update_cat.conf";
177
 
-
 
-
 
187
$update_file_ossi_cat="/usr/local/etc/update_ossi_cat.conf";
178
$bl_safesearch="off";
188
$bl_safesearch="off";
179
$bl_pureip="off";
189
$bl_pureip="off";
-
 
190
$updateable_ossi_bls=["ossi-bl-candc"];
180
 
191
 
181
# default values
192
# default values
182
if (is_file ($conf_file))
193
if (is_file ($conf_file))
183
{
194
{
184
	$tab=file($conf_file);
195
	$tab=file($conf_file);
185
	if ($tab)
196
	if ($tab)
186
	{
197
	{
187
		foreach ($tab as $line)
198
		foreach ($tab as $line)
188
		{
199
		{
189
			$field=explode("=", $line);
200
			$field=explode("=", $line);
190
			switch ($field[0]) {
201
			switch ($field[0]) {
191
				case 'PRIVATE_IP':
202
				case 'PRIVATE_IP':
192
					$PRIVATE_IP_MASK=trim($field[1]);
203
					$PRIVATE_IP_MASK=trim($field[1]);
193
					$tmp = explode("/",$PRIVATE_IP_MASK);
204
					$tmp = explode("/",$PRIVATE_IP_MASK);
194
					$PRIVATE_IP=$tmp[0];
205
					$PRIVATE_IP=$tmp[0];
195
					break;
206
					break;
196
 
207
 
197
				case 'BL_SAFESEARCH':
208
				case 'BL_SAFESEARCH':
198
					if (strtolower(trim($field[1])) == 'on') {
209
					if (strtolower(trim($field[1])) == 'on') {
199
						$bl_safesearch='on';
210
						$bl_safesearch='on';
200
					}
211
					}
201
					break;
212
					break;
202
 
213
 
203
				case 'BL_PUREIP':
214
				case 'BL_PUREIP':
204
					if (strtolower(trim($field[1])) == 'on') {
215
					if (strtolower(trim($field[1])) == 'on') {
205
						$bl_pureip='on';
216
						$bl_pureip='on';
206
					}
217
					}
207
					break;
218
					break;
208
			}
219
			}
209
		}
220
		}
210
	}
221
	}
211
}
222
}
212
else { echo "$l_error_open_file $conf_file";}
223
else { echo "$l_error_open_file $conf_file";}
213
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
224
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
214
switch ($choix)
225
switch ($choix)
215
{
226
{
216
	case 'Download_list' :
227
	case 'Download_list' :
217
		exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
228
		exec ("sudo /usr/local/bin/alcasar-bl.sh --download");
218
		break;
229
		break;
219
	case 'Active_list' :
230
	case 'Active_list' :
220
		exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
231
		exec ("sudo /usr/local/bin/alcasar-bl.sh --adapt");
221
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
232
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
222
		break;
233
		break;
223
	case 'Reject_list' :
234
	case 'Reject_list' :
224
		unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
235
		unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
225
		break;
236
		break;
226
	case 'MAJ_cat_bl' :
237
	case 'MAJ_cat_bl' :
227
		if (file_exists($bl_categories_enabled))
238
		if (file_exists($bl_categories_enabled))
228
		{
239
		{
229
			exec("/bin/sed -i \"/^ossi-/!d\" $bl_categories_enabled"); // keep ossi custom categories
240
			exec("/bin/sed -i \"/^ossi-/!d\" $bl_categories_enabled"); // keep ossi custom categories
230
			$pointeur=fopen($bl_categories_enabled, "a+");
241
			$pointeur=fopen($bl_categories_enabled, "a+");
231
			$fichier=fopen($update_file_cat,"w+");
-
 
232
			foreach ($_POST as $key => $value)
242
			foreach ($_POST as $key => $value)
233
			{
243
			{
234
				if (strstr($key,'chk-'))
244
				if (strstr($key,'chk-'))
235
				{
245
				{
236
					$line=str_replace('chk-','',$key)."\n";
246
					$line=str_replace('chk-','',$key)."\n";
237
					fwrite($pointeur,$line);
247
					fwrite($pointeur,$line);
238
					if(trim($line) == 'malware' && $_POST['update_cat'] == 1) //auto-update of malware
-
 
239
					{
-
 
240
						fputs($fichier, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n");
-
 
241
					}
-
 
242
				}
248
				}
243
			}
249
			}
244
			fclose($pointeur);
250
			fclose($pointeur);
245
			fclose($fichier);
-
 
246
		}
251
		}
247
		else {echo "$l_error_open_file $bl_categories_enabled";}
252
		else {echo "$l_error_open_file $bl_categories_enabled";}
248
		$fichier=fopen($dir_blacklist."ossi-bl/domains","w+");
253
		$fichier=fopen($dir_blacklist."ossi-bl/domains","w+");
249
		fputs($fichier, form_filter($_POST['OSSI_bl']));
254
		fputs($fichier, form_filter($_POST['OSSI_bl']));
250
		fclose($fichier);
255
		fclose($fichier);
251
		unset($_POST['OSSI_bl']);
256
		unset($_POST['OSSI_bl']);
252
		$fichier=fopen($dir_dg."exceptionsitelist","w+");
257
		$fichier=fopen($dir_dg."exceptionsitelist","w+");
253
		fputs($fichier, form_filter($_POST['BL_rehabilited_domains']));
258
		fputs($fichier, form_filter($_POST['BL_rehabilited_domains']));
254
		fclose($fichier);
259
		fclose($fichier);
255
		unset($_POST['BL_rehabilited_domains']);
260
		unset($_POST['BL_rehabilited_domains']);
256
		$fichier=fopen($dir_dg."exceptioniplist","w+");
261
		$fichier=fopen($dir_dg."exceptioniplist","w+");
257
		fputs($fichier, form_filter($_POST['BL_rehabilited_ip']));
262
		fputs($fichier, form_filter($_POST['BL_rehabilited_ip']));
258
		fclose($fichier);
263
		fclose($fichier);
259
		unset($_POST['BL_rehabilited_ip']);
264
		unset($_POST['BL_rehabilited_ip']);
260
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
265
		exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
261
		break;
266
		break;
262
	case 'Specific_filtering':
267
	case 'Specific_filtering':
263
		$bl_pureip='off';
268
		$bl_pureip='off';
264
		$bl_safesearch='off';
269
		$bl_safesearch='off';
265
		foreach ($_POST as $key => $value)
270
		foreach ($_POST as $key => $value)
266
		{
271
		{
267
			if (strstr($key,'chk-ip')) $bl_pureip="on";
272
			if (strstr($key,'chk-ip')) $bl_pureip="on";
268
			if (strstr($key,'chk-safesearch')) $bl_safesearch="on";
273
			if (strstr($key,'chk-safesearch')) $bl_safesearch="on";
269
		}
274
		}
270
		exec ("sudo /usr/local/bin/alcasar-url_filter_bl.sh -safesearch_$bl_safesearch -pureip_$bl_pureip");
275
		exec ("sudo /usr/local/bin/alcasar-url_filter_bl.sh -safesearch_$bl_safesearch -pureip_$bl_pureip");
271
		break;
276
		break;
272
	case 'MAJ_ossi_file' :
277
	case 'MAJ_ossi_file' :
273
		foreach($_POST as $fichier => $value)
278
		foreach($_POST as $fichier => $value)
274
		{
279
		{
275
			if($fichier != "choix")
280
			if($fichier != "choix" && $fichier != "update_cat")
276
			{
281
			{
277
				$action=$_POST[$fichier];
282
				$action=$_POST[$fichier];
278
				if($action == $l_remove) //delete
283
				if($action == $l_remove) //delete
279
				{
284
				{
280
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $bl_categories_enabled");
285
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $bl_categories_enabled");
281
					exec("/bin/sed -i ".escapeshellarg("/$fichier\$/d")." $bl_categories");
286
					exec("/bin/sed -i ".escapeshellarg("/$fichier\$/d")." $bl_categories");
282
					exec("rm -rf $dir_blacklist".escapeshellarg($fichier));
287
					exec("rm -rf $dir_blacklist".escapeshellarg($fichier));
283
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
288
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
284
				}
289
				}
285
				if($action == $l_disable) //disable
290
				if($action == $l_disable) //disable
286
				{
291
				{
-
 
292
 
287
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $bl_categories_enabled");
293
					exec("/bin/sed -i ".escapeshellarg("/^$fichier\$/d")." $bl_categories_enabled");
288
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
294
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
289
				}
295
				}
290
				if($action == $l_enable) //enable
296
				if($action == $l_enable) //enable
291
				{
297
				{
292
					file_put_contents ($bl_categories_enabled, $fichier."\n", FILE_APPEND);
298
					file_put_contents($bl_categories_enabled, $fichier."\n", FILE_APPEND);
293
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
299
					exec("sudo /usr/local/bin/alcasar-bl.sh --reload 2>&1", $out, $ret);
-
 
300
				}
-
 
301
				if($action == $l_update) //update
-
 
302
				{
-
 
303
				    if ($fichier == ossi-bl-candc)
-
 
304
                    {
-
 
305
					    exec("sudo /usr/local/bin/alcasar-bl-autoupdate.sh --update_ossi-bl-candc 2>&1", $out, $ret);
-
 
306
				        if ($ret == 0)
-
 
307
				        {
-
 
308
					        echo "<p>".$l_update_success."</p>";
-
 
309
				        }
-
 
310
				        else
-
 
311
				        {
-
 
312
					        echo "<p>".$l_update_failed.":</p>";
-
 
313
					        foreach($out as $line)
-
 
314
					        {
-
 
315
						        echo "<p>".$line."</p>";
-
 
316
					        }
-
 
317
				        }
-
 
318
                    }
-
 
319
				}
-
 
320
			}	
-
 
321
		}
-
 
322
        break;
-
 
323
	case 'Autoupdate' :
-
 
324
		// Reset updatelists, truncate files
-
 
325
		$f = fopen($update_file_ossi_cat, 'w');
-
 
326
		fclose($f);
-
 
327
        $f = fopen($update_file_ossi_cat, 'w');
-
 
328
		fclose($f);
-
 
329
		
-
 
330
        foreach($_POST as $fichier => $value)
-
 
331
		{
-
 
332
			// General BL
-
 
333
			if ($fichier == 'update_cat' && $value == 1)
-
 
334
			{
-
 
335
				if (file_exists($bl_categories_enabled))
-
 
336
				{
-
 
337
					file_put_contents($update_file_cat, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n", FILE_APPEND);
294
				}
338
				}
295
			}
339
			}
-
 
340
		    // C&C Server List
-
 
341
		    if ($fichier == 'ossi-bl-candc' && $value == 1)
-
 
342
		    {
-
 
343
	            file_put_contents($update_file_ossi_cat, "alcasar-bl-autoupdate.sh --update_ossi-bl-candc\n", FILE_APPEND);
-
 
344
		    }
296
		}
345
		}
297
		break;
346
		break;
298
	case 'MAJ_ossi_file_upload' :
347
	case 'MAJ_ossi_file_upload' :
299
		$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
348
		$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
300
		$dest_dir = $dir_blacklist."ossi-bl-".$file_name; # /etc/e2guardian/list/blacklist/ossi-bl-XXXXXXXX
349
		$dest_dir = $dir_blacklist."ossi-bl-".$file_name; # /etc/e2guardian/list/blacklist/ossi-bl-XXXXXXXX
301
		if((!empty($file_name)) && (!file_exists($dest_dir)))
350
		if((!empty($file_name)) && (!file_exists($dest_dir)))
302
		{
351
		{
303
			exec("mkdir ".escapeshellarg($dest_dir));
352
			exec("mkdir ".escapeshellarg($dest_dir));
304
			$file=$_FILES['fichier_ip']['tmp_name'];
353
			$file=$_FILES['fichier_ip']['tmp_name'];
305
			exec('/usr/bin/dos2unix '.escapeshellarg($file));
354
			exec('/usr/bin/dos2unix '.escapeshellarg($file));
306
			if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains")) // copy in the file "domains" (containing @ip & domain names (like over Toulouse categories))
355
			if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains")) // copy in the file "domains" (containing @ip & domain names (like over Toulouse categories))
307
			{
356
			{
308
				touch ($dest_dir."/urls"); // create the URL file even if it isn't used
357
				touch ($dest_dir."/urls"); // create the URL file even if it isn't used
309
				file_put_contents ($bl_categories, $dest_dir."\n", FILE_APPEND); # add to the categories list
358
				file_put_contents ($bl_categories, $dest_dir."\n", FILE_APPEND); // add to the categories list
310
				file_put_contents ($bl_categories_enabled, "ossi-bl-".$file_name."\n", FILE_APPEND); //Enabled by default
359
				file_put_contents ($bl_categories_enabled, "ossi-bl-".$file_name."\n", FILE_APPEND); //Enabled by default
311
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
360
				exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
312
			}
361
			}
313
			else
362
			else
314
			{
363
			{
315
				exec("rm -rf ".escapeshellarg($dest_dir));
364
				exec("rm -rf ".escapeshellarg($dest_dir));
316
				echo $l_error_upload;
365
				echo $l_error_upload;
317
			}
366
			}
318
		}
367
		}
319
		break;
368
		break;
320
}
369
}
321
?>
370
?>
322
<table width="100%" border="0" cellspacing="0" cellpadding="0">
371
<table width="100%" border="0" cellspacing="0" cellpadding="0">
323
	<tr><th>
372
	<tr><th>
324
	<?php echo $l_list_version; echo date ("F d Y", filemtime ('/etc/e2guardian/lists/blacklists/README'));?>
373
	<?php echo $l_list_version; echo date ("F d Y", filemtime ('/etc/e2guardian/lists/blacklists/README'));?>
325
	</th></tr>
374
	</th></tr>
326
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
375
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
327
</table>
376
</table>
328
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
377
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
329
<tr><td valign="middle" align="left" colspan=10>
378
<tr><td valign="middle" align="left" colspan=10>
330
<FORM action='bl_filter.php' method=POST>
379
<FORM action='bl_filter.php' method=POST>
331
<?php
380
<?php
332
if ((file_exists("$dir_tmp/blacklists.tar.gz")) && (file_exists("$dir_tmp/md5sum")))
381
if ((file_exists("$dir_tmp/blacklists.tar.gz")) && (file_exists("$dir_tmp/md5sum")))
333
{
382
{
334
	echo "$l_fingerprint"; echo_file ("$dir_tmp/md5sum");
383
	echo "$l_fingerprint"; echo_file ("$dir_tmp/md5sum");
335
	echo "<br>$l_fingerprint2<a href='http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST' target='cat_help' onclick=\"window.open('http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST','cat_help','width=600,height=150,toolbar=no,scrollbars=yes,resizable=yes')\" title='verify fingerprint'>dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST</a><br>";
384
	echo "<br>$l_fingerprint2<a href='http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST' target='cat_help' onclick=\"window.open('http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST','cat_help','width=600,height=150,toolbar=no,scrollbars=yes,resizable=yes')\" title='verify fingerprint'>dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST</a><br>";
336
	echo "<input type='hidden' name='choix' value='Active_list'>";
385
	echo "<input type='hidden' name='choix' value='Active_list'>";
337
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_activate_bl'> ($l_warning)</FORM>";
386
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_activate_bl'> ($l_warning)</FORM>";
338
	echo "<FORM action='bl_filter.php' method=POST>";
387
	echo "<FORM action='bl_filter.php' method=POST>";
339
	echo "<input type='hidden' name='choix' value='Reject_list'>";
388
	echo "<input type='hidden' name='choix' value='Reject_list'>";
340
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_reject_bl'></form>";
389
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_reject_bl'></form>";
341
}
390
}
342
else
391
else
343
{
392
{
344
	echo "<input type='hidden' name='choix' value='Download_list'>";
393
	echo "<input type='hidden' name='choix' value='Download_list'>";
345
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_download_bl'> ($l_warning)</form>";
394
	echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_download_bl'> ($l_warning)</form>";
346
}
395
}
347
?>
396
?>
348
</td></tr>
397
</td></tr>
349
</table><br>
398
</table><br>
350
<table width="100%" border="0" cellspacing="0" cellpadding="0">
399
<table width="100%" border="0" cellspacing="0" cellpadding="0">
351
	<tr><th><?php echo $l_bl; ?></th></tr>
400
	<tr><th><?php echo $l_bl; ?></th></tr>
352
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
401
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
353
</table>
402
</table>
354
<FORM action='bl_filter.php' method=POST>
403
<FORM action='bl_filter.php' method=POST>
355
<input type='hidden' name='choix' value='MAJ_cat_bl'>
404
<input type='hidden' name='choix' value='MAJ_cat_bl'>
356
<table width="100%" border=1 cellspacing=0 cellpadding=1>
405
<table width="100%" border=1 cellspacing=0 cellpadding=1>
357
<tr><td valign="middle" align="left" colspan=10>
406
<tr><td valign="middle" align="left" colspan=10>
358
<?php
407
<?php
359
echo "<center>";
408
echo "<center>";
360
// total number of IP, DNS & URLs
409
// total number of IP, DNS & URLs
361
$nbDomainNames = exec("wc -l /usr/local/share/unbound-bl/* | tail -n 1 | awk '{print $1}'") / 2;
410
$nbDomainNames = exec("wc -l /usr/local/share/unbound-bl/* | tail -n 1 | awk '{print $1}'") / 2;
362
$nbUrl = exec("for file in `find /etc/e2guardian/lists/blacklists/ -name 'urls'`; do nb=$((nb+$(wc -l \$file | awk '{print $1}'))); done; echo \$nb");
411
$nbUrl = exec("for file in `find /etc/e2guardian/lists/blacklists/ -name 'urls'`; do nb=$((nb+$(wc -l \$file | awk '{print $1}'))); done; echo \$nb");
363
$nbIp = exec("wc -l /usr/local/share/iptables-bl/* | tail -n 1 | awk '{print $1}'");
412
$nbIp = exec("wc -l /usr/local/share/iptables-bl/* | tail -n 1 | awk '{print $1}'");
364
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
413
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
365
echo "$l_bl_categories</center></td></tr>";
414
echo "$l_bl_categories</center></td></tr>";
366
//read & display all BL categories (checked or not)
415
//read & display all BL categories (checked or not)
367
$cols=1;
416
$cols=1;
368
if (file_exists($bl_categories))
417
if (file_exists($bl_categories))
369
{
418
{
370
	$bl_files = file($bl_categories);
419
	$bl_files = file($bl_categories);
371
	$bl_files = preg_grep("/ossi-/", $bl_files, 1); // don't display ossi custom categories
420
	$bl_files = preg_grep("/ossi-/", $bl_files, 1); // don't display ossi custom categories
372
	foreach($bl_files as $fichier => $value)
421
	foreach($bl_files as $fichier => $value)
373
	{
422
	{
374
		if ($cols == 1) { echo "<tr>";}
423
		if ($cols == 1) { echo "<tr>";}
375
		$categorie=trim(basename($value));
424
		$categorie=trim(basename($value));
376
		echo "<td><a href='bl_categories_help.php?liste=bl&cat=$categorie' target='cat_help' onclick=\"window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>$categorie</a><br>";
425
		echo "<td><a href='bl_categories_help.php?liste=bl&cat=$categorie' target='cat_help' onclick=\"window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>$categorie</a><br>";
377
		echo "<input type='checkbox' name='chk-$categorie'";
426
		echo "<input type='checkbox' name='chk-$categorie'";
378
		// if the line is commented, the category is disable
427
		// if the line is commented, the category is disable
379
		if (preg_match('/^#/',$value, $r)) { echo ">";}
428
		if (preg_match('/^#/',$value, $r)) { echo ">";}
380
		else { echo " checked>"; }
429
		else { echo " checked>"; }
381
		echo "</td>";
430
		echo "</td>";
382
		$cols++;
431
		$cols++;
383
		if ($cols > 10) {
432
		if ($cols > 10) {
384
			echo "</tr>\n";
433
			echo "</tr>\n";
385
			$cols=1;
434
			$cols=1;
386
		}
435
		}
387
	}
436
	}
388
}
437
}
389
else {
438
else {
390
	echo "$l_error_open_file $bl_categories";
439
	echo "$l_error_open_file $bl_categories";
391
}
440
}
392
 
441
 
393
//update categories with rsync
-
 
394
$update_select = array();
-
 
395
$update_select[0] = "";
-
 
396
$update_select[1] = "";
-
 
397
 
-
 
398
if ( 0 == filesize( $update_file_cat ) ) $update_select[0] = "checked";
-
 
399
else $update_select[1] = "checked";
-
 
400
 
-
 
401
echo "</tr>\n";
442
echo "</tr>\n";
402
echo "<tr><td valign='middle' align='left' colspan=10>";
443
echo "<tr><td valign='middle' align='left' colspan=10>";
403
echo "<center>$l_update_cat
444
echo "<center>
404
	<input type='radio' name='update_cat' value=0 $update_select[0]> $l_disable
-
 
405
	<input type='radio' name='update_cat' value=1 $update_select[1]> $l_enable
-
 
406
	<input type='submit' value='$l_record'></center>";
445
	<input type='submit' value='$l_record'></center>";
407
echo "</td></tr>";
446
echo "</td></tr>";
408
echo "<tr><td valign='middle' align='left' colspan=10>";
447
echo "<tr><td valign='middle' align='left' colspan=10>";
409
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
448
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
410
echo "<tr><td width=50% colspan=5 align=center>";
449
echo "<tr><td width=50% colspan=5 align=center>";
411
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
450
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
412
echo "<textarea name='BL_rehabilited_domains' rows=3 cols=40>";
451
echo "<textarea name='BL_rehabilited_domains' rows=3 cols=40>";
413
echo_file ($dir_dg."exceptionsitelist");
452
echo_file ($dir_dg."exceptionsitelist");
414
echo "</textarea></td>";
453
echo "</textarea></td>";
415
echo "<td width=50% colspan=5 align=center>";
454
echo "<td width=50% colspan=5 align=center>";
416
echo "<H3>$l_rehabilitated_ip</H3>$l_rehabilitated_ip_explain<BR>$l_one_ip<BR>";
455
echo "<H3>$l_rehabilitated_ip</H3>$l_rehabilitated_ip_explain<BR>$l_one_ip<BR>";
417
echo "<textarea name='BL_rehabilited_ip' rows=3 cols=40>";
456
echo "<textarea name='BL_rehabilited_ip' rows=3 cols=40>";
418
echo_file ($dir_dg."exceptioniplist");
457
echo_file ($dir_dg."exceptioniplist");
419
echo "</textarea></td></tr>";
458
echo "</textarea></td></tr>";
420
echo "<tr><td valign='middle' align='left' colspan=10>";
459
echo "<tr><td valign='middle' align='left' colspan=10>";
421
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
460
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
422
echo "<tr><td width=100% colspan=10 align=center>";
461
echo "<tr><td width=100% colspan=10 align=center>";
423
echo "$l_one_dns_ip<BR>";
462
echo "$l_one_dns_ip<BR>";
424
echo "<textarea name='OSSI_bl' rows=3 cols=40>";
463
echo "<textarea name='OSSI_bl' rows=3 cols=40>";
425
echo_file ($dir_blacklist."ossi-bl/domains");
464
echo_file ($dir_blacklist."ossi-bl/domains");
426
echo "</textarea></td>";
465
echo "</textarea></td>";
427
echo "</tr><tr><td colspan=10>";
466
echo "</tr><tr><td colspan=10>";
428
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
467
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>";
429
echo "</td></tr></table><br>";
468
echo "</td></tr></table><br>";
430
echo "</form> ($l_wait)";
469
echo "</form> ($l_wait)";
431
?>
470
?>
432
<table width="100%" border="0" cellspacing="0" cellpadding="0">
471
<table width="100%" border="0" cellspacing="0" cellpadding="0">
433
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
472
	<tr><th><?php echo $l_additional_file_title; ?></th></tr>
434
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
473
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
435
</table>
474
</table>
436
<table width="100%" border=1 cellspacing=0 cellpadding=1>
475
<table width="100%" border=1 cellspacing=0 cellpadding=1>
437
<?php
476
<?php
438
echo "<tr><td width=50% colspan=5 align=center>";
477
echo "<tr><td width=50% colspan=5 align=center>";
439
echo "<H3>$l_file_list</H3>";
478
echo "<H3>$l_file_list</H3>";
440
echo "<form action='bl_filter.php' method='POST'>";
479
echo "<form action='bl_filter.php' method='POST'>";
441
echo "<input type='hidden' name='choix' value='MAJ_ossi_file'>";
480
echo "<input type='hidden' name='choix' value='MAJ_ossi_file'>";
442
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=2>$l_file_action</tr>";
481
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_nb_domain_names<th colspan=3>$l_file_action</tr>";
443
//list OSSI custom categories
482
//list OSSI custom categories
444
$fichiersbl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
483
$fichiersbl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
445
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
484
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
446
foreach($fichiersbl as $fichier => $value)
485
foreach($fichiersbl as $fichier => $value)
447
{
486
{
448
	echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&filtre=domain' target='cat_help' onclick=\"window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_bl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_bl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
487
	echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&filtre=domain' target='cat_help' onclick=\"window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_bl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_bl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
449
	if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
488
	if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
450
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
489
	echo "</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td>";
-
 
490
	if (in_array($value,$updateable_ossi_bls)) echo "<td><center><input type='submit' name='$value' value='$l_update'></center></td>"; else echo "<td><center>$l_no_update_configured</center></td>";
-
 
491
	echo "</tr>";
451
}
492
}
-
 
493
 
-
 
494
echo "</table>";
452
echo "</table></form><br></td>";
495
echo "</form><br></td>";
453
echo "<td width=50% colspan=5 align=center><H3>$l_add_file</H3>";
496
echo "<td width=50% colspan=5 align=center><H3>$l_add_file</H3>";
454
echo "$l_add_file_explain";
497
echo "$l_add_file_explain";
455
echo "<form action='bl_filter.php' method='POST' enctype='multipart/form-data'>";
498
echo "<form action='bl_filter.php' method='POST' enctype='multipart/form-data'>";
456
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'>";
499
echo "<input type='hidden' name='choix' value='MAJ_ossi_file_upload'>";
457
echo "<input type='file' name='fichier_ip'>";
500
echo "<input type='file' name='fichier_ip'>";
458
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
501
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_submit'>";
459
echo "</form>";
502
echo "</form>";
460
echo "</td></tr>";
503
echo "</td></tr>";
461
echo "</table><br>";
504
echo "</table><br>";
-
 
505
 
-
 
506
// Autoupdate Section
-
 
507
// ----------------------
-
 
508
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
-
 
509
echo '  <tr><th>'.$l_update_cat_header.'</th></tr>';
-
 
510
echo '	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>';
-
 
511
echo '</table>';
-
 
512
 
-
 
513
echo "<form action='bl_filter.php' method='POST'>";
-
 
514
echo "<input type='hidden' name='choix' value='Autoupdate'>";
-
 
515
?>
-
 
516
<table width="100%" border=1 cellspacing=0 cellpadding=1>
-
 
517
<tr><td>
-
 
518
<?php
-
 
519
echo "<table cellspacing=2 cellpadding=3 border=1>";
-
 
520
echo "<tr>";
-
 
521
 
-
 
522
// general BL
-
 
523
$update_select = ["", ""];
-
 
524
if ( 0 == filesize( $update_file_cat ) ) $update_select[0] = "checked";
-
 
525
else $update_select[1] = "checked";
-
 
526
echo "<td>".$l_update_cat."</td>";
-
 
527
echo "<td><input type='radio' name='update_cat' value=0 ".$update_select[0]." >".$l_disable;
-
 
528
echo "<input type='radio' name='update_cat' value=1 ".$update_select[1]." >".$l_enable;
-
 
529
echo "</td>";
-
 
530
// Display update checkbox for each updateable ossi-bl
-
 
531
foreach($updateable_ossi_bls as $value)
-
 
532
{
-
 
533
    //check if autoupdate is enabled
-
 
534
    $update_ossi_select = ["", ""];
-
 
535
    if ( strpos(file_get_contents($update_file_ossi_cat),$value) !== false ) $update_ossi_select[1] = "checked";
-
 
536
    else $update_ossi_select[0] = "checked";
-
 
537
    echo "<tr><td>".$value."</td>";
-
 
538
	echo "<td><input type='radio' name='".$value."' value=0 ".$update_ossi_select[0]." >".$l_disable;
-
 
539
	echo "<input type='radio' name='".$value."' value=1 ".$update_ossi_select[1]." >".$l_enable."</td>";
-
 
540
    echo "</tr>";
-
 
541
}
-
 
542
echo "</tr></td><br />";
-
 
543
echo "</table>";
-
 
544
echo "<input type='submit' value='$l_record'></center>";
-
 
545
echo "</table>";
-
 
546
echo "</form>";
462
?>
547
?>
463
<table width="100%" border="0" cellspacing="0" cellpadding="0">
548
<table width="100%" border="0" cellspacing="0" cellpadding="0">
464
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
549
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
465
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
550
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
466
</table>
551
</table>
467
<FORM action='bl_filter.php' method='POST'>
552
<FORM action='bl_filter.php' method='POST'>
468
<input type='hidden' name='choix' value='Specific_filtering'>
553
<input type='hidden' name='choix' value='Specific_filtering'>
469
<table width="100%" border=1 cellspacing=0 cellpadding=1>
554
<table width="100%" border=1 cellspacing=0 cellpadding=1>
470
<tr><td>
555
<tr><td>
471
<input type='checkbox' name='chk-ip' <?= $bl_pureip == 'on' ? 'checked' : ''; ?>><?= $l_ip_filtering; ?>
556
<input type='checkbox' name='chk-ip' <?= $bl_pureip == 'on' ? 'checked' : ''; ?>><?= $l_ip_filtering; ?>
472
</td></tr>
557
</td></tr>
473
<tr><td>
558
<tr><td>
474
<input type='checkbox' name='chk-safesearch' <?= $bl_safesearch == 'on' ? 'checked' : ''; ?>><?= $l_safe_searching; ?>
559
<input type='checkbox' name='chk-safesearch' <?= $bl_safesearch == 'on' ? 'checked' : ''; ?>><?= $l_safe_searching; ?>
475
</tr></td>
560
</tr></td>
476
<tr><td>
561
<tr><td>
477
<?= "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>"; ?>
562
<?= "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';submit();\" value='$l_record'>"; ?>
478
</td></tr>
563
</td></tr>
479
</table>
564
</table>
480
</form>
565
</form>
481
</BODY>
566
</BODY>
482
</HTML>
567
</HTML>
483
 
568