29,11 → 29,11 |
} |
if($color == "white") |
{ |
return preg_replace("/(.*)\n/", "add whitelist_ip_allowed $1\n", $new_list); |
return preg_replace("/(.*)\n/", "add wl_ip_allowed $1\n", $new_list); |
} |
else |
{ |
return preg_replace("/(.*)\n/", "add blacklist_ip_blocked $1\n", $new_list); |
return preg_replace("/(.*)\n/", "add bl_ip_blocked $1\n", $new_list); |
} |
} |
function echo_file ($filename) |
191,7 → 191,7 |
$dir_tmp="/tmp/blacklists"; |
$upload_dir_ip = "/usr/local/share/iptables-bl-enabled/"; |
$upload_dir_domain_names = "/usr/local/share/dnsmasq-bl-enabled/"; |
$cron_apache = "/etc/cron.d/alcasar-update-categories"; |
$cron_apache = "/etc/cron.d/alcasar-update-cat"; |
# default values |
if (is_file ($conf_file)) |
{ |
235,9 → 235,20 |
{ |
$line=str_replace('chk-','',$key)."\n"; |
fwrite($pointeur,$line); |
|
if(trim($line) == 'malware') |
{ |
$cron_malware = 1; |
$fichier=fopen($cron_apache,"w+"); |
fputs($fichier, "# update malware categories every 12 hours\n"); |
fputs($fichier, "* 0-23/12 * * * /usr/local/bin/alcasar-bl.sh --update-cat malware rsync://ftp.ut-capitole.fr/blacklist/dest/malware\n"); |
} |
} |
} |
if(!$cron_malware) |
{ |
$fichier=fopen($cron_apache,"w+"); |
fputs($fichier, "# malware updates disabled\n"); |
} |
|
fclose($pointeur); |
} |
295,7 → 306,7 |
exec("sort -u $upload_dir_ip\ossi_ip > $upload_dir_ip\ossi-$nom && rm -f $upload_dir_ip\ossi_ip"); |
|
# On adapte le fichier à la sauvegarde du set |
exec("sed -i \"s/^/add blacklist_ip_blocked /g\" $upload_dir_ip\ossi-$nom"); |
exec("sed -i \"s/^/add bl_ip_blocked /g\" $upload_dir_ip\ossi-$nom"); |
|
|
# On extrait uniquement les noms de domaine |
444,7 → 455,7 |
exec("cd $upload_dir_ip && ls | grep ossi-", $fichiersIp); |
foreach($fichiersIp as $fichier => $value) |
{ |
echo "<tr><td><center>".exec("sed 's/^.....//g' <<< $value")."</center></td><td><center>".exec("wc -l $upload_dir_ip$value | awk '{print $1}'")."</center></td><td><center>".exec("wc -l $upload_dir_domain_names$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>"; |
echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&ossi=yes&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'>".exec("sed 's/^.....//g' <<< $value")."</a></center></td><td><center>".exec("wc -l $upload_dir_ip$value | awk '{print $1}'")."</center></td><td><center>".exec("wc -l $upload_dir_domain_names$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>"; |
} |
echo "</table><br/></td></form><form action='bl_filter.php' method='POST' enctype='multipart/form-data'>"; |
echo "<input type='hidden' name='choix' value='MAJ_ip_file_upload'><td width=50% colspan=5 align=center>"; |