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 |