Guest User

tables

a guest
Jul 16th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.94 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. modprobe -v ip_set
  4. modprobe -v ip_set_hash_netport
  5.  
  6. #create list for IPs
  7. ipset create whitelist hash:net
  8.  
  9. for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/pl.zone)
  10. do
  11.   sudo ipset add whitelist $IP
  12. done
  13.  
  14. for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/pl.zone)
  15. do
  16.   sudo ipset add whitelist $IP
  17. done
  18.  
  19. for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/de.zone)
  20. do
  21.   sudo ipset add whitelist $IP
  22. done
  23.  
  24. for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/fr.zone)
  25. do
  26.   sudo ipset add whitelist $IP
  27. done
  28.  
  29. for IP in $(wget -O - http://ipdeny.com/ipblocks/data/countries/gb.zone)
  30. do
  31.   sudo ipset add whitelist $IP
  32. done
  33.  
  34. for IP in $(/etc/banhammer.d/whitelist)
  35. do
  36.   sudo ipset add whitelist $IP
  37. done
  38.  
  39. iptables -N countryfilter
  40.  
  41. iptables -A INPUT -j countryfilter
  42.  
  43. iptables -A countryfilter -m --set whitelist src -j RETURN
  44.  
  45. iptables -A countryfilter -j DROP
Advertisement
Add Comment
Please, Sign In to add comment