Subversion Repositories ALCASAR

Rev

Rev 826 | Go to most recent revision | Blame | Last modification | View Log

#/bin/bash
# $Id: alcasar-dg-pureip.sh 827 2012-02-14 23:32:20Z franck $

# alcasar-dg-pureip.sh
# by Yohan DUBANCHET and Richard REY
# This script is distributed under the Gnu General Public License (GPL)

# Activation / désactivation du filtrage d'url contenant des adresse IP (et non des noms de domaine)
# enable/disable filter of url that contains IP address (instead of domain names)

SED="/bin/sed -i"
function ip_disable (){
        $SED "s/^\*ip$/#*ip/g" /etc/dansguardian/lists/bannedsitelist
        service dansguardian reload
}
function ip_enable (){
        $SED "s/^\#\*ip$/*ip/g" /etc/dansguardian/lists/bannedsitelist
        service dansguardian reload
}
usage="Usage: alcasar-dg-pureip.sh {--on or -on} | {--off or -off} "
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
then
        nb_args=1
        args="-h"
fi
case $args in
        -\? | -h* | --h*)
                echo "$usage"
                exit 0
                ;;
        --on|-on)       
                ip_enable
                ;;
        --off|-off)
                ip_disable
                ;;
        *)
                echo "Argument inconnu :$1";
                echo "$usage"
                exit 1
                ;;
esac