Subversion Repositories ALCASAR

Rev

Rev 826 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 826 Rev 827
1
#/bin/bash
1
#/bin/bash
-
 
2
# $Id: alcasar-dg-pureip.sh 827 2012-02-14 23:32:20Z franck $
2
 
3
 
3
# alcasar-dg-pureip.sh
4
# alcasar-dg-pureip.sh
4
# by Yohan DUBANCHET and Richard REY
5
# by Yohan DUBANCHET and Richard REY
5
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
6
 
7
 
7
# Activation / désactivation du filtrage d'url contenant des adresse IP (et non des noms de domaine)
8
# Activation / désactivation du filtrage d'url contenant des adresse IP (et non des noms de domaine)
8
# enable/disable filter of url that contains IP address (instead of domain names)
9
# enable/disable filter of url that contains IP address (instead of domain names)
9
 
10
 
10
SED="/bin/sed -i"
11
SED="/bin/sed -i"
11
function ip_disable (){
12
function ip_disable (){
12
	$SED "s/^\*ip$/#*ip/g" /etc/dansguardian/lists/bannedsitelist
13
	$SED "s/^\*ip$/#*ip/g" /etc/dansguardian/lists/bannedsitelist
13
	service dansguardian reload
14
	service dansguardian reload
14
}
15
}
15
function ip_enable (){
16
function ip_enable (){
16
	$SED "s/^\#\*ip$/*ip/g" /etc/dansguardian/lists/bannedsitelist
17
	$SED "s/^\#\*ip$/*ip/g" /etc/dansguardian/lists/bannedsitelist
17
	service dansguardian reload
18
	service dansguardian reload
18
}
19
}
19
usage="Usage: alcasar-dg-pureip.sh {--on or -on} | {--off or -off} "
20
usage="Usage: alcasar-dg-pureip.sh {--on or -on} | {--off or -off} "
20
nb_args=$#
21
nb_args=$#
21
args=$1
22
args=$1
22
if [ $nb_args -eq 0 ]
23
if [ $nb_args -eq 0 ]
23
then
24
then
24
	nb_args=1
25
	nb_args=1
25
	args="-h"
26
	args="-h"
26
fi
27
fi
27
case $args in
28
case $args in
28
	-\? | -h* | --h*)
29
	-\? | -h* | --h*)
29
		echo "$usage"
30
		echo "$usage"
30
		exit 0
31
		exit 0
31
		;;
32
		;;
32
	--on|-on)	
33
	--on|-on)	
33
		ip_enable
34
		ip_enable
34
		;;
35
		;;
35
	--off|-off)
36
	--off|-off)
36
		ip_disable
37
		ip_disable
37
		;;
38
		;;
38
	*)
39
	*)
39
		echo "Argument inconnu :$1";
40
		echo "Argument inconnu :$1";
40
		echo "$usage"
41
		echo "$usage"
41
		exit 1
42
		exit 1
42
		;;
43
		;;
43
esac
44
esac
44
 
45
 
45
 
46