Subversion Repositories ALCASAR

Rev

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

Rev 1488 Rev 1521
Line 66... Line 66...
66
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
66
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
67
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
67
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
68
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
68
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
69
if($Language == 'fr'){
69
if($Language == 'fr'){
70
  $l_bl="Liste noire";
70
  $l_bl="Liste noire";
71
  $l_wl="Liste blanche";
-
 
72
  $l_list_version="Version de la liste : ";
71
  $l_list_version="Version de la liste : ";
73
  $l_bl_categories="Sélectionnez les catégories à filtrer";
72
  $l_bl_categories="Sélectionnez les catégories à filtrer";
74
  $l_wl_categories="Sélectionnez les catégories à autoriser";
-
 
75
  $l_download_bl="Télécharger la dernière version";
73
  $l_download_bl="Télécharger la dernière version";
76
  $l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
74
  $l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
77
  $l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
75
  $l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
78
  $l_activate_bl="Activer la nouvelle version";
76
  $l_activate_bl="Activer la nouvelle version";
79
  $l_reject_bl="Rejeter";
77
  $l_reject_bl="Rejeter";
80
  $l_warning="Temps estimé : une minute.";
78
  $l_warning="Temps estimé : une minute.";
81
  $l_specific_filtering="Filtrage special";
79
  $l_specific_filtering="Filtrage special";
82
  $l_forbidden_dns="Noms de domaine filtrés";
80
  $l_forbidden_dns="Noms de domaine filtrés";
83
  $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
-
 
84
  $l_allowed_dns="Noms de domaine autorisés";
-
 
85
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
81
  $l_one_dns="Entrez un nom de domaine par ligne (exemple : .domaine.org)";
86
  $l_maj_rehabilitated="Noms de domaine ou IP réhabilités";
82
  $l_maj_rehabilitated="Noms de domaine ou IP réhabilités";
87
  $l_rehabilitated_dns="Noms de domaine réhabilités";
83
  $l_rehabilitated_dns="Noms de domaine réhabilités";
88
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
84
  $l_rehabilitated_dns_explain="Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
89
  $l_add_to_bl="Noms de domaine ou IP ajoutés à la liste noire";
85
  $l_add_to_bl="Noms de domaine ou IP ajoutés à la liste noire";
90
  $l_add_to_wl="Noms de domaine ou IP ajoutés à la liste blanche";
-
 
91
  $l_forbidden_ip="IP filtrés";
86
  $l_forbidden_ip="IP filtrés";
92
  $l_forbidden_ip_explain="Entrez une IP par ligne (exemple : 123.123.123.123)<br/>ou une ADRESSE RESEAU (exemple : 123.123.0.0/16)";
87
  $l_forbidden_ip_explain="Entrez une IP par ligne (exemple : 123.123.123.123)<br/>ou une ADRESSE RESEAU (exemple : 123.123.0.0/16)";
93
  $l_allowed_ip="IP authorisées";
-
 
94
  $l_rehabilitated_ip="IP réhabilitées";
88
  $l_rehabilitated_ip="IP réhabilitées";
95
  $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.";
96
  $l_one_ip="Entrez une IP par ligne (exemple : 123.123.123.123)";
90
  $l_one_ip="Entrez une IP par ligne (exemple : 123.123.123.123)";
97
  $l_record="Enregistrer les modifications";
91
  $l_record="Enregistrer les modifications";
98
  $l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
92
  $l_wait="Une fois validées, 10 secondes sont nécessaires pour traiter vos modifications";
Line 115... Line 109...
115
  $l_nbUrl="Url :";
109
  $l_nbUrl="Url :";
116
  $l_nbIp="Ip :";
110
  $l_nbIp="Ip :";
117
}
111
}
118
else {
112
else {
119
  $l_bl="BlackList";
113
  $l_bl="BlackList";
120
  $l_wl="WhiteList";
-
 
121
  $l_list_version="List version : ";
114
  $l_list_version="List version : ";
122
  $l_bl_categories="Select the categories to filter";
115
  $l_bl_categories="Select the categories to filter";
123
  $l_wl_categories="Select the categories to allow";
-
 
124
  $l_download_bl="Download the last version";
116
  $l_download_bl="Download the last version";
125
  $l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
117
  $l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
126
  $l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
118
  $l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
127
  $l_activate_bl="Activate the new version";
119
  $l_activate_bl="Activate the new version";
128
  $l_reject_bl="Reject";
120
  $l_reject_bl="Reject";
129
  $l_warning="Estimated time : one minute.";
121
  $l_warning="Estimated time : one minute.";
130
  $l_specific_filtering="Specific filtering";
122
  $l_specific_filtering="Specific filtering";
131
  $l_forbidden_dns="Filtered domain names";
123
  $l_forbidden_dns="Filtered domain names";
132
  $l_forbidden_dns_explain="Enter one domain name per row (exemple : .domain.org)";
-
 
133
  $l_allowed_dns="Allowed domain names";
124
  $l_allowed_dns="Allowed domain names";
134
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
125
  $l_one_dns="Enter one domain name per row (example : .domain.org)";
135
  $l_maj_rehabilitated="Domain names or IP rehabilitated";
126
  $l_maj_rehabilitated="Domain names or IP rehabilitated";
136
  $l_rehabilitated_dns="Rehabilitated domain names";
127
  $l_rehabilitated_dns="Rehabilitated domain names";
137
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
128
  $l_rehabilitated_dns_explain="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
138
  $l_add_to_bl="Domain names or IP to add to blacklist";
129
  $l_add_to_bl="Domain names or IP to add to blacklist";
139
  $l_add_to_wl="Domain names or IP to add to whitelist";
-
 
140
  $l_forbidden_ip="Filtered IP";
130
  $l_forbidden_ip="Filtered IP";
141
  $l_forbidden_ip_explain="Enter one IP per row (example : 123.123.123.123)<br/>or a NETWORK ADDRESS (example : 123.123.0.0/16)";
131
  $l_forbidden_ip_explain="Enter one IP per row (example : 123.123.123.123)<br/>or a NETWORK ADDRESS (example : 123.123.0.0/16)";
142
  $l_allowed_ip="Allowed IP";
-
 
143
  $l_rehabilitated_ip="Rehabilitated IP";
132
  $l_rehabilitated_ip="Rehabilitated IP";
144
  $l_rehabilitated_ip_explain="Enter here IP that are blocked by the blacklist <BR> and you want to rehabilitate.";
133
  $l_rehabilitated_ip_explain="Enter here IP that are blocked by the blacklist <BR> and you want to rehabilitate.";
145
  $l_one_ip="Enter one IP per row (example : 123.123.123.123)";
134
  $l_one_ip="Enter one IP per row (example : 123.123.123.123)";
146
  $l_record="Save changes";
135
  $l_record="Save changes";
147
  $l_wait="Once validated, 10 seconds are necessary to compute your modifications";
136
  $l_wait="Once validated, 10 seconds are necessary to compute your modifications";
Line 165... Line 154...
165
  $l_nbIp="Ip :";
154
  $l_nbIp="Ip :";
166
}
155
}
167
$dir_etc="/usr/local/etc/";
156
$dir_etc="/usr/local/etc/";
168
$dir_dg="/etc/dansguardian/lists/";
157
$dir_dg="/etc/dansguardian/lists/";
169
$dir_bl_ip="/usr/local/share/iptables-bl/";
158
$dir_bl_ip="/usr/local/share/iptables-bl/";
170
$file_wl_ip="/usr/local/share/ossi-ip-wl";
-
 
171
$bl_categories=$dir_etc."alcasar-bl-categories";
159
$bl_categories=$dir_etc."alcasar-bl-categories";
172
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
160
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
173
$wl_categories=$dir_etc."alcasar-wl-categories";
-
 
174
$wl_categories_enabled=$dir_etc."alcasar-wl-categories-enabled";
-
 
175
$conf_file=$dir_etc."alcasar.conf";
161
$conf_file=$dir_etc."alcasar.conf";
176
$dir_blacklist=$dir_dg."blacklist/";
162
$dir_blacklist=$dir_dg."blacklist/";
177
$urlregex_file=$dir_dg."urlregexplist";
163
$urlregex_file=$dir_dg."urlregexplist";
178
$bannedsite_file=$dir_dg."bannedsitelist";
164
$bannedsite_file=$dir_dg."bannedsitelist";
179
$dir_tmp="/tmp/blacklists";
165
$dir_tmp="/tmp/blacklists";
Line 238... Line 224...
238
	fputs($fichier, form_filter($_POST['BL_rehabilited_ip']));
224
	fputs($fichier, form_filter($_POST['BL_rehabilited_ip']));
239
	fclose($fichier);
225
	fclose($fichier);
240
	unset($_POST['BL_rehabilited_ip']);
226
	unset($_POST['BL_rehabilited_ip']);
241
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
227
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
242
	break;
228
	break;
243
case 'MAJ_cat_wl' :
-
 
244
	$tab=file($wl_categories_enabled);	
-
 
245
	if ($tab)
-
 
246
		{
-
 
247
		$pointeur=fopen($wl_categories_enabled, "w+");
-
 
248
		foreach ($_POST as $key => $value)
-
 
249
			{
-
 
250
			if (strstr($key,'chk-'))
-
 
251
				{	
-
 
252
				$line=str_replace('chk-','',$key)."\n";
-
 
253
				fwrite($pointeur,$line);
-
 
254
				}
-
 
255
			}
-
 
256
		fclose($pointeur);
-
 
257
		}
-
 
258
	else {echo "$l_error_open_file $wl_categories_enabled";}
-
 
259
	$fichier=fopen($dir_dg."blacklists/ossi/domains_wl","w+");
-
 
260
	fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
-
 
261
	fclose($fichier);
-
 
262
	unset($_POST['OSSI_wl_domains']);
-
 
263
	$fichier=fopen($file_wl_ip, "w+");
-
 
264
	fputs($fichier, form_filter_ip($_POST['OSSI_wl_ip'], "white"));
-
 
265
	fclose($fichier);
-
 
266
	unset($_POST['OSSI_wl_ip']);
-
 
267
	exec ("sudo /usr/local/sbin/alcasar-bl.sh --reload");
-
 
268
	break;
-
 
269
case 'Specific_filtering' :
229
case 'Specific_filtering' :
270
	$pureip="-pureip_off"; $safesearch="-safesearch_off"; ;
230
	$pureip="-pureip_off"; $safesearch="-safesearch_off"; ;
271
	foreach ($_POST as $key => $value)
231
	foreach ($_POST as $key => $value)
272
	{
232
	{
273
		if (strstr($key,'chk-ip')) $pureip="-pureip_on";
233
		if (strstr($key,'chk-ip')) $pureip="-pureip_on";
Line 420... Line 380...
420
echo_file ($dir_dg."exceptioniplist");
380
echo_file ($dir_dg."exceptioniplist");
421
echo "</textarea></td></tr><tr><td width=50% colspan=10>";
381
echo "</textarea></td></tr><tr><td width=50% colspan=10>";
422
echo "<tr><td valign='middle' align='left' colspan=10>";
382
echo "<tr><td valign='middle' align='left' colspan=10>";
423
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
383
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
424
echo "<tr><td width=50% colspan=5 align=center>";
384
echo "<tr><td width=50% colspan=5 align=center>";
425
echo "<H3>$l_forbidden_dns</H3>$l_forbidden_dns_explain<BR>";
385
echo "<H3>$l_forbidden_dns</H3>$l_one_dns<BR>";
426
echo "<textarea name='OSSI_bl_domains' rows=3 cols=40>";
386
echo "<textarea name='OSSI_bl_domains' rows=3 cols=40>";
427
echo_file ($dir_dg."blacklists/ossi/domains");
387
echo_file ($dir_dg."blacklists/ossi/domains");
428
echo "</textarea></td>";
388
echo "</textarea></td>";
429
echo "<td width=50% colspan=5 align=center>";
389
echo "<td width=50% colspan=5 align=center>";
430
echo "<H3>$l_forbidden_ip</H3>$l_forbidden_ip_explain<BR>";
390
echo "<H3>$l_forbidden_ip</H3>$l_forbidden_ip_explain<BR>";
431
echo "<textarea name='OSSI_bl_ip' rows=3 cols=40>";
391
echo "<textarea name='OSSI_bl_ip' rows=3 cols=40>";
432
echo_ip_file ($dir_bl_ip."ossi");
392
echo_ip_file ($dir_bl_ip."ossi");
433
echo "</textarea></td></tr><tr><td colspan=10>";
393
echo "</textarea></td></tr><tr><td colspan=10>";
434
echo "<input type='submit' value='$l_record'>";
394
echo "<input type='submit' value='$l_record'>";
435
echo "</form> ($l_wait)";
395
echo "</form> ($l_wait)";
436
echo "</table></td><br/>";
396
echo "</td></tr></table><br/>";
437
?>
397
?>
438
<table width="100%" border="0" cellspacing="0" cellpadding="0">
398
<table width="100%" border="0" cellspacing="0" cellpadding="0">
439
	<tr><th><?php echo $l_personal_file_title; ?></th></tr>
399
	<tr><th><?php echo $l_personal_file_title; ?></th></tr>
440
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
400
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
441
</table>
401
</table>
Line 459... Line 419...
459
echo "</td></tr>";
419
echo "</td></tr>";
460
echo "</form>";
420
echo "</form>";
461
echo "</table><br/>";
421
echo "</table><br/>";
462
?>
422
?>
463
<table width="100%" border="0" cellspacing="0" cellpadding="0">
423
<table width="100%" border="0" cellspacing="0" cellpadding="0">
464
	<tr><th><?php echo $l_wl; ?></th></tr>
-
 
465
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
466
</table>
-
 
467
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
-
 
468
<tr><td valign="middle" align="left" colspan=10>
-
 
469
<FORM action='bl_filter.php' method=POST>
-
 
470
<input type='hidden' name='choix' value='MAJ_cat_wl'>
-
 
471
<?php
-
 
472
echo "<center>";
-
 
473
$nbDomainNames = exec ("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
-
 
474
$nbUrl = 0;
-
 
475
$nbIp = 0;
-
 
476
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
-
 
477
echo "$l_wl_categories</center></td></tr>";
-
 
478
//on lit et on interprete le fichier de catégories
-
 
479
$cols=1; 
-
 
480
if (file_exists($wl_categories))
-
 
481
	{
-
 
482
	$pointeur=fopen($wl_categories,"r");
-
 
483
	while (!feof ($pointeur))
-
 
484
		{
-
 
485
		$ligne=fgets($pointeur, 4096);
-
 
486
		if ($ligne)
-
 
487
			{
-
 
488
			if ($cols == 1) { echo "<tr>";}
-
 
489
			$categorie=trim(basename($ligne));
-
 
490
			echo "<td><a href='bl_categories_help.php?liste=wl&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>";
-
 
491
			echo "<input type='checkbox' name='chk-$categorie'";
-
 
492
			// si la ligne est commentée -> categorie non selectionnée
-
 
493
			if (preg_match('/^#/',$ligne, $r)) { echo ">";}
-
 
494
			else { echo "checked>"; }
-
 
495
			echo "</td>";
-
 
496
			$cols++;
-
 
497
			if ($cols > 10) {
-
 
498
				echo "</tr>";
-
 
499
				$cols=1; }
-
 
500
			}
-
 
501
		}
-
 
502
	fclose($pointeur);
-
 
503
	}
-
 
504
else	{
-
 
505
	echo "$l_error_open_file $wl_categories";
-
 
506
	}
-
 
507
echo "<tr><td valign='middle' align='left' colspan=10>";
-
 
508
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
-
 
509
echo "<tr><td width=50% colspan=5 align=center>";
-
 
510
echo "<H3>$l_allowed_dns</H3>$l_forbidden_dns_explain<BR>";
-
 
511
echo "<textarea name='OSSI_wl_domains' rows=3 cols=40>";
-
 
512
echo_file ($dir_dg."blacklists/ossi/domains_wl");
-
 
513
echo "</textarea></td>";
-
 
514
echo "<td width=50% colspan=5 align=center>";
-
 
515
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";
-
 
516
echo "<textarea name='OSSI_wl_ip' rows=3 cols=40>";
-
 
517
echo_ip_file ($file_wl_ip);
-
 
518
echo "</textarea></td></tr><tr><td colspan=10>";
-
 
519
echo "<input type='submit' value='$l_record'></form></td></tr>";
-
 
520
?>
-
 
521
</TABLE><br/>
-
 
522
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
 
523
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
424
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
524
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
425
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
525
</table>
426
</table>
526
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
427
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
527
<FORM action='bl_filter.php' method='POST'>
428
<FORM action='bl_filter.php' method='POST'>