Skip to content

Instantly share code, notes, and snippets.

@Luavis
Created December 19, 2013 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luavis/8034991 to your computer and use it in GitHub Desktop.
Save Luavis/8034991 to your computer and use it in GitHub Desktop.
#!/bin/bash
DATA=./GeoIPCountryWhois.csv
IPT=/sbin/iptables
for IPRANGE in `egrep "China" $DATA | cut -d, -f1,2 | sed -e 's/"//g' | sed -e 's/,/-/g'`
do
$IPT -A INPUT -p all -m iprange --src-range $IPRANGE -j DROP
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment