e-badips 358 B

1234567891011121314
  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. curl -f -s -m 60 -o $tmp "https://www.badips.com/get/list/${banservice}/${banlevel}?age=${rangecheck}"
  8. while read -r ip ; do
  9. ipset -! add ${banset} ${ip}
  10. done < $tmp
  11. trap "/bin/rm -f ${tmp}" EXIT SIGHUP SIGINT SIGTERM