All pastes #416930 Raw Edit

Wirefall

public shellscript v1 · immutable
#416930 ·published 2007-03-30 16:18 UTC
rendered paste body
#!/bin/bashif [ ! -e /var/log/wirefall ]then touch /var/log/wirefallfiif [ "$2" == "on" ]then	log_check        APPEND="-A"        INSERT="-I"	echo $1 >> /var/log/wirefallelif [ "$2" == "off" ]then	log_check        APPEND="-D"        INSERT="-D"	cat /var/log/wirefall | grep -v $1 > /var/log/delete && mv /var/log/delete /var/log/wirefallelse	echo "Error: \"off\" or \"on\" expected as second argument"	exit 1fi	log_check() {info=`cat /var/log/wirefall | grep ^${1}`if [ "$info" != "" ]then	echo "Error: $1 already blocked/unlocked"	exit 1fi}iptables $INSERT INPUT   -s $1 -j DROPiptables $INSERT OUTPUT  -d $1 -j DROPiptables $INSERT FORWARD -d $1 -j DROP echo "IP ${1} drop ${2}."exit