Subversion Repositories ALCASAR

Rev

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

Rev 1873 Rev 1874
Line 131... Line 131...
131
  $l_nb_domain_names="Nombre de noms de domaine";
131
  $l_nb_domain_names="Nombre de noms de domaine";
132
  $l_nbDomainNames="Noms de domaine :";
132
  $l_nbDomainNames="Noms de domaine :";
133
  $l_nbUrl="Url :";
133
  $l_nbUrl="Url :";
134
  $l_nbIp="Ip :";
134
  $l_nbIp="Ip :";
135
  $l_update_cat="Mise a jour des catégories automatiquement?";
135
  $l_update_cat="Mise a jour des catégories automatiquement?";
136
  $l_no_update_cat = "désactiver";
136
	$l_no_update_cat = "Désactiver";
137
  $l_1_update_cat = "toutes les 12 heures";
137
  $l_yes_update_cat = "Activer (Toutes les 12 heures)";
138
  $l_2_update_cat = "toutes les semaines";
-
 
139
  $l_3_update_cat = "tous les mois";
-
 
140
}
138
}
141
else {
139
else {
142
  $l_bl="BlackList";
140
  $l_bl="BlackList";
143
  $l_load="Loading...";
141
  $l_load="Loading...";
144
  $l_list_version="List version : ";
142
  $l_list_version="List version : ";
Line 183... Line 181...
183
  $l_nbDomainNames="Domain names :";
181
  $l_nbDomainNames="Domain names :";
184
  $l_nbUrl="Url :";
182
  $l_nbUrl="Url :";
185
  $l_nbIp="Ip :";
183
  $l_nbIp="Ip :";
186
  $l_update_cat="Mise a jour des catégories automatiquement?";
184
  $l_update_cat="Mise a jour des catégories automatiquement?";
187
  $l_no_update_cat = "Disable";
185
  $l_no_update_cat = "Disable";
188
  $l_1_update_cat = "every 12 hours";
186
  $l_yes_update_cat = "Enable (Every 12 hours)";
189
  $l_2_update_cat = "every weeks";
-
 
190
  $l_3_update_cat = "every month";
-
 
191
}
187
}
192
$dir_etc="/usr/local/etc/";
188
$dir_etc="/usr/local/etc/";
193
$dir_dg="/etc/dansguardian/lists/";
189
$dir_dg="/etc/dansguardian/lists/";
194
$dir_bl_ip="/usr/local/share/iptables-bl/";
190
$dir_bl_ip="/usr/local/share/iptables-bl/";
195
$bl_categories=$dir_etc."alcasar-bl-categories";
191
$bl_categories=$dir_etc."alcasar-bl-categories";
Line 199... Line 195...
199
$urlregex_file=$dir_dg."urlregexplist";
195
$urlregex_file=$dir_dg."urlregexplist";
200
$bannedsite_file=$dir_dg."bannedsitelist";
196
$bannedsite_file=$dir_dg."bannedsitelist";
201
$dir_tmp="/tmp/blacklists";
197
$dir_tmp="/tmp/blacklists";
202
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/";
198
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/";
203
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/";
199
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/";
204
$cron_apache = "/etc/cron.d/alcasar-update-cat";
-
 
205
$update_file_cat="/usr/local/etc/update_cat.conf";
200
$update_file_cat="/usr/local/etc/update_cat.conf";
206
if(isset($_POST['update_cat']))
-
 
207
{
-
 
208
 
-
 
209
	$fichier=fopen($cron_apache,"w+");
-
 
210
	$update_mode = $_POST['update_cat'];
-
 
211
	switch($update_mode){
-
 
212
		case 0:
-
 
213
			fputs($fichier, "#0 update with rsync categories is disabled\n");
-
 
214
			break;
-
 
215
		case 1:
-
 
216
			fputs($fichier, "#1 update with rsync every 12 hours\n");
-
 
217
			fputs($fichier, "0 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
218
			break;
-
 
219
		case 2:
-
 
220
			fputs($fichier, "#2 update with rsync every week (Sunday) at 00:00\n");
-
 
221
			fputs($fichier, "0 0 * * 0 /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
222
			break;
-
 
223
		case 3:
-
 
224
			fputs($fichier, "#3 update with rsync every month (1st) at 00:00\n");
-
 
225
			fputs($fichier, "0 0 1 * * /usr/local/bin/alcasar-bl.sh --update_cat \n");
-
 
226
			break;
-
 
227
	}
-
 
228
 
201
 
229
 
202
 
230
	fclose($fichier);
-
 
231
}
-
 
232
 
-
 
233
# default values
203
# default values
234
if (is_file ($conf_file))
204
if (is_file ($conf_file))
235
	{
205
	{
236
	$tab=file($conf_file);
206
	$tab=file($conf_file);
237
	if ($tab)
207
	if ($tab)
Line 246... Line 216...
246
				$PRIVATE_IP=$tmp[0];
216
				$PRIVATE_IP=$tmp[0];
247
				}
217
				}
248
			}
218
			}
249
		}
219
		}
250
	}
220
	}
-
 
221
	
-
 
222
#update categories via rsync
-
 
223
$update_select = array();
-
 
224
$update_select[0] = "";
-
 
225
$update_select[1] = "";
-
 
226
 
-
 
227
if ( 0 == filesize( $update_file_cat ) ) $update_select[0] = "checked";
-
 
228
else $update_select[1] = "checked";
-
 
229
	
-
 
230
	
251
else { echo "$l_error_open_file $conf_file";}
231
else { echo "$l_error_open_file $conf_file";}
252
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
232
if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
253
switch ($choix)
233
switch ($choix)
254
{
234
{
255
case 'Download_list' :
235
case 'Download_list' :
Line 263... Line 243...
263
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
243
	unlink ("$dir_tmp/blacklists.tar.gz"); unlink ("$dir_tmp/md5sum");
264
	break;
244
	break;
265
case 'MAJ_cat_bl' :
245
case 'MAJ_cat_bl' :
266
	if (file_exists($bl_categories_enabled))
246
	if (file_exists($bl_categories_enabled))
267
	{
247
	{
-
 
248
		$fichier=fopen($update_file_cat,"w+");
268
		$pointeur=fopen($bl_categories_enabled, "w+");
249
		$pointeur=fopen($bl_categories_enabled, "w+");
269
		foreach ($_POST as $key => $value)
250
		foreach ($_POST as $key => $value)
270
			{
251
			{
271
			if (strstr($key,'chk-'))
252
			if (strstr($key,'chk-'))
272
			{	
253
			{	
273
				$line=str_replace('chk-','',$key)."\n";
254
				$line=str_replace('chk-','',$key)."\n";
274
				fwrite($pointeur,$line);
255
				fwrite($pointeur,$line);
275
				if(trim($line) == 'malware' && $update_mode > 0)
256
				if(trim($line) == 'malware' && $update_select[1] == "checked")
276
				{
257
				{
277
					$fichier=fopen($update_file_cat,"w+");
-
 
278
					fputs($fichier, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n");
258
					fputs($fichier, "malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n");
279
				}
259
				}
280
			}
260
			}
281
			}
261
			}
282
			
262
			
Line 439... Line 419...
439
	}
419
	}
440
else	{
420
else	{
441
	echo "$l_error_open_file $bl_categories";
421
	echo "$l_error_open_file $bl_categories";
442
}
422
}
443
 
423
 
444
#update categories via rsync
-
 
445
$update_select = array();
-
 
446
$update_select[0] = "";
-
 
447
$update_select[1] = "";
-
 
448
$update_select[2] = "";
-
 
449
$update_select[3] = "";
-
 
450
 
-
 
451
$pointeur=fopen($cron_apache,'r');
-
 
452
while (!feof ($pointeur))
-
 
453
{
-
 
454
	$line=fgets($pointeur,1024);
-
 
455
	if(explode(' ',$line)[0] === "#0")
-
 
456
		$update_select[0]="checked";
-
 
457
	if(explode(' ',$line)[0] === "#1")
-
 
458
		$update_select[1]="checked";
-
 
459
	if(explode(' ',$line)[0] === "#2")
-
 
460
		$update_select[2]="checked";
-
 
461
	if(explode(' ',$line)[0] === "#3")
-
 
462
		$update_select[3]="checked";
-
 
463
}
-
 
464
fclose($pointeur);
-
 
465
 
424
 
-
 
425
	
466
echo "</td></tr>";
426
echo "</td></tr>";
467
echo "<tr><td valign='middle' align='left' colspan=10>";
427
echo "<tr><td valign='middle' align='left' colspan=10>";
468
echo "<center>$l_update_cat 
428
echo "<center>$l_update_cat 
469
	<input type='radio' name='update_cat' value=0 $update_select[0]> $l_no_update_cat 
429
	<input type='radio' name='update_cat' value=0 $update_select[0]> $l_no_update_cat 
470
	<input type='radio' name='update_cat' value=1 $update_select[1]> $l_1_update_cat 
430
	<input type='radio' name='update_cat' value=1 $update_select[1]> $l_yes_update_cat 
471
	<input type='radio' name='update_cat' value=2 $update_select[2]> $l_2_update_cat 
-
 
472
	<input type='radio' name='update_cat' value=3 $update_select[3]> $l_3_update_cat 
-
 
473
	<input type='submit' value='$l_record'></center>";
431
	<input type='submit' value='$l_record'></center>";
474
echo "</td></tr>";
432
echo "</td></tr>";
475
echo "<tr><td valign='middle' align='left' colspan=10>";
433
echo "<tr><td valign='middle' align='left' colspan=10>";
476
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
434
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
477
echo "<tr><td width=50% colspan=5 align=center>";
435
echo "<tr><td width=50% colspan=5 align=center>";