Subversion Repositories ALCASAR

Rev

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

Rev 2898 Rev 2918
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
3
# $Id: alcasar-bl.sh 2898 2020-12-13 23:28:18Z rexy $
3
# $Id: alcasar-bl.sh 2918 2021-02-18 22:52:46Z rexy $
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 92... Line 92...
92
	chmod 660 $WL_CATEGORIES $WL_CATEGORIES_ENABLED
92
	chmod 660 $WL_CATEGORIES $WL_CATEGORIES_ENABLED
93
}
93
}
94
 
94
 
95
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
95
# cleaning file and split it ("domains" in $FILE_tmp & "IP" in $FILE_ip_tmp)
96
function clean_split (){
96
function clean_split (){
97
	$SED '/^#.*/d' $FILE_tmp # remove commented lines
97
	$SED '/^#/d' $FILE_tmp # remove commented lines
-
 
98
	$SED '/^\./d' $FILE_tmp # remove lines beginning with a dot
98
	$SED '/^\s*$/d' $FILE_tmp # remove empty lines
99
	$SED '/^\s*$/d' $FILE_tmp # remove empty lines
99
	$SED '/[äâëêïîöôüû@,]/d' $FILE_tmp # remove line with "chelou" characters
100
	$SED '/[äâëêïîöôüû@,]/d' $FILE_tmp # remove line with "chelou" characters
100
	# extract ip addresses and ip networks for iptables.
101
	# extract ip addresses and ip networks for iptables.
101
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $FILE_tmp > $FILE_ip_tmp
102
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/{print "add bl_ip_blocked " $0}' $FILE_tmp > $FILE_ip_tmp
102
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}\/[0-9]{1,2}$/{print "add bl_ip_blocked " $0}' $FILE_tmp >> $FILE_ip_tmp
103
	awk '/^([0-9]{1,3}\.){3}[0-9]{1,3}\/[0-9]{1,2}$/{print "add bl_ip_blocked " $0}' $FILE_tmp >> $FILE_ip_tmp