]> git.friedersdorff.com Git - max/glocker.git/blob - glocker.sh
Create an IPSET of banned ip addresses
[max/glocker.git] / glocker.sh
1 #!/bin/sh
2
3 # Get list of nefarious IP addresses from www.friedersdorff.com/.banned
4
5 BANNED_HOSTS=$(curl -s https://www.friedersdorff.com/.banned | 
6   grep -o -E '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}/[[:digit:]]{1,2}')
7
8 ipset create glocker-tmp hash:net --hashsize 64
9 for host in $(echo $BANNED_HOSTS); do
10   ipset add glocker-tmp $host
11 done
12
13 ipset create -exist glocker hash:net --hashsize 64
14 ipset swap glocker-tmp glocker
15 ipset destroy glocker-tmp
16 echo "IPSet: glocker updated"