yaig is an iptables rule generator designed to take a config file and turn it into iptables rules.
ie:
object local 127.0.0.1
object shodan1 198.20.69.96/29
object shodan-io2 66.240.192.0/18
object shodan-io3 71.6.128.0/17
group shodan
object shodan1
object shodan-io2
object shodan-io3
server group shodan drop
server object local accept
to
-A INPUT -s 198.20.69.96/29 -j DROP -m comment --comment "server - Group: shodan - drop"
-A INPUT -s 66.240.192.0/18 -j DROP -m comment --comment "server - Group: shodan - drop"
-A INPUT -s 71.6.128.0/17 -j DROP -m comment --comment "server - Group: shodan - drop"
-A INPUT -s 127.0.0.1 -j ACCEPT -m comment --comment "server - Object: local - accept"
natefw would be my first attempt at this concept.