#!/bin/bash
# Copyright (C) 2001 by Bernie Innocenti <bernie@codewiz.org>


name=$1
port=$2

if [ -z "$name" ]; then
	echo "Usage: $0 <host> [<port>]"
	exit 1
fi

if [ ! -z "$port" ]; then
	portcmd="-p tcp --destination-port $port"
fi

case "`basename $0`" in
*unkill*)
	mode='-D'
	;;
*)
	mode='-A'
	;;
esac

iptables $mode INPUT -t filter -s $name $portcmd -j DROP
