Created
February 12, 2022 05:21
-
-
Save jesselawson/e313eba8e1f53a4a887a7f29d8999376 to your computer and use it in GitHub Desktop.
The last "Refresh my ipset drop list" script you'll ever need
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
#!/usr/bin/env bash | |
ipset -q flush ipsum | |
ipset -q create ipsum hash:net | |
for ip in $(curl --compressed https://raw.githubusercontent.com/stamparm/ipsum/master/ipsum.txt 2>/dev/null | grep -v "#" | grep -v -E "\s[1-2]$" | cut -f 1); do ipset add ipsum $ip; done | |
# Add any IPs here that may not be in the block list yet: | |
ipset add ipsum 110.169.9.43 | |
iptables -I INPUT -m set --match-set ipsum src -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment