e-badips 377 B

12345678910111213
  1. #!/bin/bash
  2. ((EUID == 0 )) || { echo "Need root"; exit 1; }
  3. set -euo pipefail
  4. CONFD=/etc/e-router
  5. source $CONFD/config
  6. tmp=$(mktemp)
  7. trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM
  8. curl -f -s -S -m 60 -o $tmp "https://www.badips.com/get/list/${banservice}/${banlevel}?age=${rangecheck}"
  9. while read -r ip ; do
  10. ipset -! add ${banset} ${ip} timeout $bantime
  11. done < $tmp