Skip to content

Instantly share code, notes, and snippets.

@jesselawson
Created February 12, 2022 05:21
Show Gist options
  • Save jesselawson/e313eba8e1f53a4a887a7f29d8999376 to your computer and use it in GitHub Desktop.
Save jesselawson/e313eba8e1f53a4a887a7f29d8999376 to your computer and use it in GitHub Desktop.
The last "Refresh my ipset drop list" script you'll ever need
#!/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