Skip to content

Instantly share code, notes, and snippets.

@mombrea
Forked from anonymous/gist:7415239
Last active January 1, 2016 10:59
Show Gist options
  • Save mombrea/8135081 to your computer and use it in GitHub Desktop.
Save mombrea/8135081 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Copyright 11.11.13 Michell Gailing <gailing.michell@gmail.com>
#It's Licensed under DWWWI 'Do whatever you want with it!'
wget http://www.okean.com/chinacidr.txt
sed -i '1,4d' chinacidr.txt
sed -i 's/ China//g' chinacidr.txt
ipset create china hash:net
while read line; do ipset add china $line; done < chinacidr.txt
iptables -I INPUT -m set --match-set china src -j DROP
rm chinacidr.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment