Defending Against Spam Hosts
This script should be placed into a cron job and run once a day. The only modification that the script may need is the path to the iptables utility.
The script will create an iptable called: “Spamhaus” which will house all malicious IP addresses.
Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up). It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.