Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ###PUT HERE COMA SEPARATED LIST OF COUNTRY CODE###
- COUNTRIES="TW,CN,RU"
- WORKDIR="/root"
- #######################################
- cd $WORKDIR
- wget -c --output-document=iptables-blocklist.txt http://blogama.org/country_query.php?country=$COUNTRIES
- if [ -f iptables-blocklist.txt ]; then
- iptables -F
- BLOCKDB="iptables-blocklist.txt"
- IPS=$(grep -Ev "^#" $BLOCKDB)
- for i in $IPS
- do
- iptables -A INPUT -s $i -j DROP
- iptables -A OUTPUT -d $i -j DROP
- done
- fi
- rm $WORKDIR/iptables-blocklist.txt
Advertisement
Add Comment
Please, Sign In to add comment