From 7b98db4d141f91a00ff1328e7ecc97ef96d50e10 Mon Sep 17 00:00:00 2001 From: Cyril Chaboisseau Date: Sat, 1 May 2021 12:29:15 +0200 Subject: [PATCH] improve the generation of blocking file (abusers) --- scripts/abusers.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/abusers.sh b/scripts/abusers.sh index c768434..8db66da 100755 --- a/scripts/abusers.sh +++ b/scripts/abusers.sh @@ -15,13 +15,9 @@ elif [ -S /tmp/autoconf.sock ] ; then fi # generate the new conf -curl -s "https://iplists.firehol.org/files/firehol_abusers_30d.netset" | grep -v "^\#.*" | -while read entry ; do - check=$(echo $entry | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/?[0-9]*$") - if [ "$check" != "" ] ; then - echo "deny ${entry};" >> /tmp/block-abusers.conf - fi -done +curl -s "https://iplists.firehol.org/files/firehol_abusers_30d.netset" | \ + grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/?[0-9]*$") \ + sed 's/^/deny /;s/$/;/' > /tmp/block-abusers.conf # check if we have at least 1 line lines="$(wc -l /tmp/block-abusers.conf | cut -d ' ' -f 1)"