summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-11-16 09:44:06 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-11-16 09:44:06 +0100
commit0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10 (patch)
tree1acfc4c3081a27e9ce58b597325378422d2ad394
parent7ac40198efb4f47d4ffdcc191ed24bf36b7ffe81 (diff)
downloadbin-0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10.tar.gz
bin-0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10.tar.xz
torblock: Check that icanhazip.com returns an IP
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xtorblock.sh6
1 files changed, 5 insertions, 1 deletions
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