From 0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 16 Nov 2017 09:44:06 +0100 Subject: torblock: Check that icanhazip.com returns an IP Signed-off-by: Florian Pritz --- torblock.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/torblock.sh b/torblock.sh index 5638a80..a026556 100755 --- a/torblock.sh +++ b/torblock.sh @@ -3,7 +3,11 @@ set -e get_ips() { - curl -sSL "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$(curl icanhazip.com)" | sed '/^#/d' | grep -Eo "([0-9]{1,3}[\.]){3}[0-9]{1,3}" + curl -sSL "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$(curl -s icanhazip.com | grep_ip)" | sed '/^#/d' | grep_ip +} + +grep_ip() { + grep -Eo "([0-9]{1,3}[\.]){3}[0-9]{1,3}" } ipset flush tor || true -- cgit v1.2.3-24-g4f1b