Subversion Repositories ALCASAR

Rev

Rev 2675 | Rev 2688 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2675 Rev 2678
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 2675 2018-12-14 09:56:50Z lucas.echard $
3
# $Id: alcasar-bl.sh 2678 2018-12-16 20:57:08Z lucas.echard $
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 153... Line 153...
153
				mv $DIR_DG_BL/$x $DIR_tmp
153
				mv $DIR_DG_BL/$x $DIR_tmp
154
			done
154
			done
155
			rm -rf $DIR_DG_BL $DIR_IP_BL
155
			rm -rf $DIR_DG_BL $DIR_IP_BL
156
			mkdir $DIR_DG_BL $DIR_IP_BL
156
			mkdir $DIR_DG_BL $DIR_IP_BL
157
			tar zxf $DIR_tmp/blacklists.tar.gz --directory=$DIR_DG/
157
			tar zxf $DIR_tmp/blacklists.tar.gz --directory=$DIR_DG/
-
 
158
			# replace the global_usage file of the archive
-
 
159
			cp -f $GLOBAL_USAGE $DIR_DG_BL/global_usage
158
			chown -R e2guardian:apache $DIR_DG
160
			chown -R e2guardian:apache $DIR_DG
159
			chmod -R 770 $DIR_DG
161
			chmod -R 770 $DIR_DG
-
 
162
			# Add the two local categories (ossi-bl & ossi-wl) to the usage file
-
 
163
			# Add the custom categories (ossi-tor_nodes) to the usage file
-
 
164
			cat <<EOF >> $DIR_DG_BL/global_usage
-
 
165
 
-
 
166
NAME: ossi-bl
-
 
167
DEFAULT_TYPE: black
-
 
168
SOURCE: ALCASAR Team
-
 
169
DESC FR: sites blacklistés ajoutés localement
-
 
170
DESC EN: blacklisted sites add locally
-
 
171
NAME FR: ossi-bl
-
 
172
NAME EN: ossi-bl
-
 
173
 
-
 
174
NAME: ossi-wl
-
 
175
DEFAULT_TYPE: white
-
 
176
SOURCE: ALCASAR Team
-
 
177
DESC FR: sites autorisés ajoutés localement
-
 
178
DESC EN: whitelisted sites add locally
-
 
179
NAME FR: ossi-wl
-
 
180
NAME EN: ossi-wl
-
 
181
 
-
 
182
NAME: ossi-bl-tor_nodes
-
 
183
DEFAULT_TYPE: black
-
 
184
SOURCE: ALCASAR Team
-
 
185
DESC FR: Adresses IP des noeuds (routeurs) d'entrée du réseau TOR
-
 
186
DESC EN: IP addresses of input TOR nodes (routers)
-
 
187
NAME FR: Noeuds TOR
-
 
188
NAME EN: TOR nodes
-
 
189
EOF
160
			# Retrieve custom files (ossi)
190
			# Retrieve custom files (ossi)
161
			for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
191
			for x in $(ls -1 $DIR_tmp | grep "^ossi-*")
162
			do
192
			do
163
				mv $DIR_tmp/$x $DIR_DG_BL
193
				mv $DIR_tmp/$x $DIR_DG_BL
164
			done
194
			done
Line 172... Line 202...
172
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
202
		find $DIR_DG_BL/ -type f -name domains > $FILE_tmp # retrieve directory name where a domain file exist
173
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
203
		$SED "s?\/domains??g" $FILE_tmp # remove "/domains" suffix
174
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
204
		for dir_categorie in `cat $FILE_tmp` # create the blacklist and the whitelist files
175
		do
205
		do
176
			categorie=`echo $dir_categorie|cut -d "/" -f6`
206
			categorie=`echo $dir_categorie|cut -d "/" -f6`
177
			categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie\$ $GLOBAL_USAGE | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
207
			categorie_type=`grep -A1 ^NAME:[$' '$'\t']*$categorie\$ $DIR_DG_BL/global_usage | grep ^DEFAULT_TYPE | cut -d":" -f2 | tr -d " \t"`
178
			if [ "$categorie_type" == "white" ]
208
			if [ "$categorie_type" == "white" ]
179
			then
209
			then
180
				echo "$dir_categorie" >> $WL_CATEGORIES
210
				echo "$dir_categorie" >> $WL_CATEGORIES
181
			else
211
			else
182
				echo "$dir_categorie" >> $BL_CATEGORIES
212
				echo "$dir_categorie" >> $BL_CATEGORIES