Line 1... |
Line 1... |
1 |
#/bin/bash
|
1 |
#/bin/bash
|
2 |
|
2 |
|
3 |
# $Id: alcasar-bl.sh 1056 2013-03-26 21:46:36Z stephane $
|
3 |
# $Id: alcasar-bl.sh 1057 2013-03-27 22:05:36Z richard $
|
4 |
|
4 |
|
5 |
# alcasar-bl.sh
|
5 |
# alcasar-bl.sh
|
6 |
# by Franck BOUIJOUX and Richard REY
|
6 |
# by Franck BOUIJOUX and Richard REY
|
7 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
# This script is distributed under the Gnu General Public License (GPL)
|
8 |
|
8 |
|
Line 42... |
Line 42... |
42 |
# process the file $BL_CATEGORIES with the choice of categories
|
42 |
# process the file $BL_CATEGORIES with the choice of categories
|
43 |
for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
|
43 |
for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
|
44 |
do
|
44 |
do
|
45 |
$SED "/\/$ENABLE_CATEGORIE$/d" $BL_CATEGORIES
|
45 |
$SED "/\/$ENABLE_CATEGORIE$/d" $BL_CATEGORIES
|
46 |
$SED "1i\/etc\/dansguardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $BL_CATEGORIES
|
46 |
$SED "1i\/etc\/dansguardian\/lists\/blacklists\/$ENABLE_CATEGORIE" $BL_CATEGORIES
|
47 |
ln -s $DIR_DNS_BL/$ENABLE_CATEGORIE $DIR_DNS_BL_ENABLED/$ENABLE_CATEGORIE
|
47 |
ln -s $DIR_DNS_BL/$ENABLE_CATEGORIE.conf $DIR_DNS_BL_ENABLED/$ENABLE_CATEGORIE
|
48 |
ln -s $DIR_IP_BL/$ENABLE_CATEGORIE $DIR_IP_BL_ENABLED/$ENABLE_CATEGORIE
|
48 |
ln -s $DIR_IP_BL/$ENABLE_CATEGORIE $DIR_IP_BL_ENABLED/$ENABLE_CATEGORIE
|
49 |
echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist # we let DG filters domain in order to prevent bypass by proxy http vpn ;-)
|
49 |
echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/domains>" >> $DIR_DG/bannedsitelist # we let DG filters domain in order to prevent bypass by proxy http vpn ;-)
|
50 |
echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
|
50 |
echo ".Include<$DIR_DG_BL/$ENABLE_CATEGORIE/urls>" >> $DIR_DG/bannedurllist
|
51 |
done
|
51 |
done
|
52 |
sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
|
52 |
sort +0.0 -0.2 $BL_CATEGORIES -o $FILE_tmp
|
Line 158... |
Line 158... |
158 |
else
|
158 |
else
|
159 |
echo "$dir_categorie" >> $BL_CATEGORIES
|
159 |
echo "$dir_categorie" >> $BL_CATEGORIES
|
160 |
fi
|
160 |
fi
|
161 |
done
|
161 |
done
|
162 |
rm -f $FILE_tmp
|
162 |
rm -f $FILE_tmp
|
- |
|
163 |
# Verify that the enabled categories are effectively in the BL (need after an update of the BL)
|
- |
|
164 |
for ENABLE_CATEGORIE in `cat $BL_CATEGORIES_ENABLED`
|
- |
|
165 |
do
|
- |
|
166 |
ok=`grep /$ENABLE_CATEGORIE$ $BL_CATEGORIES|wc -l`
|
- |
|
167 |
if [ $ok != "1" ]
|
- |
|
168 |
then
|
- |
|
169 |
$SED "/^$ENABLE_CATEGORIE$/d" $BL_CATEGORIES_ENABLED
|
- |
|
170 |
fi
|
- |
|
171 |
done
|
163 |
# Creation of DNSMASQ BL and WL
|
172 |
# Creation of DNSMASQ BL and WL
|
164 |
for LIST in $BL_CATEGORIES $WL_CATEGORIES # for each list (bl and wl)
|
173 |
for LIST in $BL_CATEGORIES $WL_CATEGORIES # for each list (bl and wl)
|
165 |
do
|
174 |
do
|
166 |
for PATH_FILE in `cat $LIST` # for each category
|
175 |
for PATH_FILE in `cat $LIST` # for each category
|
167 |
do
|
176 |
do
|