improve the generation of blocking file (abusers)

This commit is contained in:
Cyril Chaboisseau 2021-05-01 12:29:15 +02:00 committed by GitHub
parent 07be626842
commit 7b98db4d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -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)"