Last active
January 9, 2017 03:28
-
-
Save thimslugga/4c5ef3494503ef0e09a85043599bbc90 to your computer and use it in GitHub Desktop.
Revised emerging threats list script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NETGROUP="ET-A" | |
curl -O http://rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt | |
getnetblocks() { | |
cat <<EOF | |
# Generated by ipset | |
-N geotmp nethash --hashsize 1024 --probes 4 --resize 20 | |
EOF | |
cat /config/user-data/emerging-Block-IPs.txt|egrep '^[0-9]'|egrep '/' |sed -e "s/^/-A geotmp /" | |
} | |
getnetblocks > /config/user-data/netblock.txt | |
sudo ipset -! -R < /config/user-data/netblock.txt | |
sudo ipset -W geotmp ET-N | |
sudo ipset -X geotmp | |
getaddblocks() { | |
cat <<EOF | |
# Generated by ipset | |
-N geotmp nethash --hashsize 1024 --probes 4 --resize 20 | |
EOF | |
cat /config/user-data/emerging-Block-IPs.txt|egrep '^[0-9]'|egrep -v '/' |sed -e "s/^/-A geotmp /" | |
} | |
getaddblocks > /config/user-data/addblock.txt | |
sudo ipset -! -R < /config/user-data/addblock.txt | |
sudo ipset -W geotmp ET-A | |
sudo ipset -X geotmp | |
RESULT="updated list for $NETGROUP" | |
logger -i -s $RESULT | |
rm /config/user-data/addblock.txt | |
rm /config/user-data/netblock.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment