From ddb2b859164826d3fb7b484ac27cd39df09e3922 Mon Sep 17 00:00:00 2001 From: Cyril Chaboisseau Date: Sat, 1 May 2021 12:25:43 +0200 Subject: [PATCH] improve generation of block file (Tor exit nodes) --- scripts/exit-nodes.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/exit-nodes.sh b/scripts/exit-nodes.sh index 8ecfdb1..43b549c 100644 --- a/scripts/exit-nodes.sh +++ b/scripts/exit-nodes.sh @@ -15,13 +15,9 @@ elif [ -S /tmp/autoconf.sock ] ; then fi # generate the new conf -curl -s "https://iplists.firehol.org/files/tor_exits.ipset" | 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-tor-exit-node.conf - fi -done +curl -s "https://iplists.firehol.org/files/tor_exits.ipset" | \ + 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-tor-exit-node.conf # check if we have at least 1 line lines="$(wc -l /tmp/block-tor-exit-node.conf | cut -d ' ' -f 1)"