How can I bulk add a text file full of IP blocks to IPTables using BASH (or another scripting language)? Or is there some other way of blocking these address ranges?
EDIT: In other words is there a way to program something to iterate through the file and build the relevant entries?
Could you just create a loop within your iptables config script? Something like
#!/bin/bash
for x in $(cat ip_list.txt)
do
iptables -A INPUT -s $x -j DROP
done
Where your ip_list.txt
file would just look like
1.1.1.1
2.2.2.2
3.3.3.3
etc