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