Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save HackersZone/e45d0740fbf06124a509e445b6c95ad7 to your computer and use it in GitHub Desktop.

Select an option

Save HackersZone/e45d0740fbf06124a509e445b6c95ad7 to your computer and use it in GitHub Desktop.
countryblock.sh
#!/bin/bash
#Script to process ip ranges to ban using IPSet and IPTables
ipset create countryblock hash:net
while read line; do ipset add countryblock $line; done < blocklist.txt
iptables -I INPUT -m set --match-set countryblock src -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment