Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1953 → Rev 1954

/web/acc/admin/bl_filter.php
2,7 → 2,7
<HTML><!-- written by Rexy -->
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>ALCASAR DNS filtering</TITLE>
<TITLE>ALCASAR DNS BL filtering</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
137,7 → 137,7
$l_file_state="Etat";
}
else {
$l_bl="BlackList";
$l_bl="General BlackList";
$l_load="Loading...";
$l_list_version="List version : ";
$l_bl_categories="Select the categories to filter";
188,7 → 188,9
$dir_dg="/etc/dansguardian/lists/";
$dir_blacklist=$dir_dg."blacklists/";
$dir_bl_ip="/usr/local/share/iptables-bl/";
$dir_bl_dns="/usr/local/share/dnsmasq-bl/";
$dir_bl_ip_enabled="/usr/local/share/iptables-bl-enabled/";
$dir_bl_domain_names="/usr/local/share/dnsmasq-bl/";
$dir_bl_domain_names_enabled="/usr/local/share/dnsmasq-bl-enabled/";
$bl_categories=$dir_etc."alcasar-bl-categories";
$bl_categories_enabled=$dir_etc."alcasar-bl-categories-enabled";
$conf_file=$dir_etc."alcasar.conf";
195,10 → 197,6
$urlregex_file=$dir_dg."urlregexplist";
$bannedsite_file=$dir_dg."bannedsitelist";
$dir_tmp="/tmp/blacklists";
$dir_ip_enabled = "/usr/local/share/iptables-bl-enabled/";
$dir_domain_names_enabled = "/usr/local/share/dnsmasq-bl-enabled/";
$dir_ip = "/usr/local/share/iptables-bl/";
$dir_domain_names = "/usr/local/share/dnsmasq-bl/";
$update_file_cat="/usr/local/etc/update_cat.conf";
 
 
286,19 → 284,18
$action=$_POST[$fichier];
if($action == $l_remove) //delete
{
exec("/bin/sed -i \"/^$fichier$/d\" $bl_categories_enabled");
exec("rm -rf $dir_blacklist$fichier");
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
}
if($action == $l_disable) //disable
{
echo "$fichier - $bl_categories_enabled";
//exec("/bin/sed -i \"/^$fichier$/d\" $bl_categories_enabled");
//exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
exec("/bin/sed -i \"/^$fichier$/d\" $bl_categories_enabled");
exec("sudo /usr/local/bin/alcasar-bl.sh --reload");
}
if($action == $l_enable) //enable
{
exec("ln -s $dir_ip$fichier $dir_ip_enabled$fichier");
exec("ln -s $dir_domain_names$fichier $dir_domain_names_enables$fichier");
file_put_contents ($bl_categories_enabled, $fichier."\n", FILE_APPEND);
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
}
}
305,10 → 302,10
}
break;
case 'MAJ_ossi_file_upload' :
$nom = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
if(!empty($nom))
$file_name = str_replace (".", "_",basename($_FILES['fichier_ip']['name']));
if(!empty($file_name))
{
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dir_blacklist."ossi-bl-".$nom))
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dir_blacklist."ossi-bl-".$file_name))
{
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload");
}
343,11 → 340,9
else
{
echo "<input type='hidden' name='choix' value='Download_list'>";
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';\" value='$l_download_bl'>";
echo " ($l_warning)";
echo "<input type='submit' onClick=\"this.disabled=true; this.value='$l_load';\" value='$l_download_bl'> ($l_warning)</form>";
}
?>
</FORM>
</td></tr>
</table><br/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
360,7 → 355,7
<input type='hidden' name='choix' value='MAJ_cat_bl'>
<?php
echo "<center>";
// total nnumber of IP, DNS & URLs
// total number of IP, DNS & URLs
$nbDomainNames = exec ("wc -l /usr/local/share/dnsmasq-bl/* | tail -n 1 | awk '{print $1}'");
$nbUrl = exec ("for file in `find /etc/dansguardian/lists/blacklists/ -name 'urls'`; do nb=$((nb+$(wc -l \$file | awk '{print $1}'))); done; echo \$nb");
$nbIp = exec ("wc -l /usr/local/share/iptables-bl/* | tail -n 1 | awk '{print $1}'");
378,7 → 373,7
$categorie=trim(basename($value));
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>";
echo "<input type='checkbox' name='chk-$categorie'";
// si la ligne est commentée -> categorie non selectionnée
// if the line is commented, the category is disable
if (preg_match('/^#/',$value, $r)) { echo ">";}
else { echo "checked>"; }
echo "</td>";
448,7 → 443,9
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
foreach($fichiersbl as $fichier => $value)
{
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_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value' value='$l_disable'></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&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'";
if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
echo "</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_ossi_file_upload'><td width=50% colspan=5 align=center>";