I've been burning my brains out before finally decided to ask it here. I'm new in linux/bash scripting. So there goes my question:
I'm using this little script in order to block certain countries from accessing my server (It's a little webserver on debian)
#!/bin/bash
TERM='xterm'
#
for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/**country.zone**) ; do
ipset add blacklist $IP
done
the thing is that i don't wanna re-edit the script every time i want to block another country (change the country.zone) there are like 238 country zones that i can choose from. My question being - How can I make a script that show's me the entire list of zones and asks and me to choose one or more (ex: cn.zone) that will download and adding it to ipset.
I know it's much easier to add the ones that i don't want to block and block the rest I know i can select multiple zones at once {1.zone, 2.zone, 3.zone}.
Basically i want a script that will show me all the zones (like in a table) choose one (or more) from there and then the script will download the selected zone/s and adds them to ipset.