All pastes #417567 Raw Edit

Wirefall

public shellscript v1 · immutable
#417567 ·published 2007-03-30 23:16 UTC
rendered paste body
#!/bin/bashinfo=`cat /var/log/wirefall | grep "$1"`if [ "$info" != "" ]then	exist="yes"else	exist="no"fiif [ ! -e /var/log/wirefall ]then touch /var/log/wirefallfiif [ "$2" == "on" ]then	if [ "$exist" = "yes" ]	then		echo "Error: $1 already blocked"		exit 1	else		APPEND="-A"		INSERT="-I"		echo $1 >> /var/log/wirefall		echo "$1 locked"	fielif [ "$2" == "off" ]then	info=`cat /var/log/wirefall | grep "$1"`	if [ "$exist" = "no" ]	then		echo "Error: $1 not locked"		exit 1	else		APPEND="-D"		INSERT="-D"		touch /var/log/delete		cat /var/log/wirefall | grep -v $1 > /var/log/delete 		mv /var/log/delete /var/log/wirefall		echo "$1 unlocked"	fielse        echo "Usage: IP "	echo "\"on\" or \"off\" are expected as second argument"	exit 1fi	#iptables $INSERT INPUT   -s $1 -j DROP#iptables $INSERT OUTPUT  -d $1 -j DROP#iptables $INSERT FORWARD -d $1 -j DROP #echo "IP \"${1}\" drop ${2}."exit 0