| 1234567891011121314151617181920 |
- #!/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
- if curl -f -s -S -m 60 -o $tmp "https://www.badips.com/get/list/${banservice}/${banlevel}?age=${rangecheck}" ; then
- while read -r ip ; do
- [[ "$ip" =~ ^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$ ]] && ipset -! add ${banset} ${ip} timeout $banttl
- done < $tmp
- fi
- if curl -f -s -S -m 60 -o $tmp "http://api.blocklist.de/getlast.php?time=3600&service=all" ; then
- while read -r ip ; do
- [[ "$ip" =~ ^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$ ]] && ipset -! add ${banset} ${ip} timeout $banttl
- done < $tmp
- fi
|