Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2098 → Rev 2099

/scripts/alcasar-bl.sh
310,6 → 310,13
done
find $DIR_DG_BL/ -type f -name domains | grep ossi- > $FILE_tmp # retrieve ossi directories name where a domain file exist
$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
#retrieve max Top Level Domain for domain name synthax
MAX_TLD=$(curl http://data.iana.org/TLD/tlds-alpha-by-domain.txt | grep -v '-' | grep -v '#' | wc -L)
if [ $(echo $MAX_TLD | wc -c) -eq 0 ];then
MAX_TLD=18
fi
for ossi_custom_dir in `cat $FILE_tmp` # create the blacklist and the whitelist files
do
ossi_categorie=`echo $ossi_custom_dir|cut -d "/" -f6`
325,10 → 332,10
$SED "s/\r//" $ossi_custom_dir/domains $ossi_custom_dir/urls # remove Windows <CR>
# extract ip addresses for iptables
awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $ossi_custom_dir/domains > $FILE_ip_tmp
# for dnsmask, remove IP addesses, accented characters and commented lines.
egrep -v "^([0-9]{1,3}\.){3}[0-9]{1,3}$" $ossi_custom_dir/domains > $FILE_tmp
$SED "/[äâëêïîöôüû]/d" $FILE_tmp
$SED "/^#.*/d" $FILE_tmp
#Extract domain name for dnsmask and check synthax of domain names
grep -Eo "([a-zA-Z0-9_-.]+\.){1,2}[a-zA-Z]{2,$MAX_TDL}" $ossi_custom_dir/domains > $FILE_tmp
if [ $categorie_type == "white" ]
then
# adapt the file to the dnsmasq syntax and enable it if needed
/web/acc/admin/bl_filter.php
62,27 → 62,6
}
}
 
#maximum length for top-level DNS
function max_tld()
{
$url_tld = "http://data.iana.org/TLD/tlds-alpha-by-domain.txt";
$result_tld = file_get_contents($url_tld,false);
$max_tld = 18; #valeur de base si le site ne répond plus
if($result_tld !== FALSE){
foreach(explode("\n", $result_tld) as $line)
{
if((strpos($line,'-') === false) and (strpos($line,'#') === false))
{
if(strlen($line) > $max_tld)
{
$max_tld = strlen($line);
}
}
}
}
return $max_tld;
}
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
/web/acc/admin/wl_filter.php
62,27 → 62,6
}
}
 
#maximum length for top-level DNS
function max_tld()
{
$url_tld = "http://data.iana.org/TLD/tlds-alpha-by-domain.txt";
$result_tld = file_get_contents($url_tld,false);
$max_tld = 18; #valeur de base si le site ne répond plus
if($result_tld !== FALSE){
foreach(explode("\n", $result_tld) as $line)
{
if((strpos($line,'-') === false) and (strpos($line,'#') === false))
{
if(strlen($line) > $max_tld)
{
$max_tld = strlen($line);
}
}
}
}
return $max_tld;
}
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){