diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-11-16 09:44:06 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-11-16 09:44:06 +0100 |
commit | 0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10 (patch) | |
tree | 1acfc4c3081a27e9ce58b597325378422d2ad394 /torblock.sh | |
parent | 7ac40198efb4f47d4ffdcc191ed24bf36b7ffe81 (diff) | |
download | bin-0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10.tar.gz bin-0ce6b3c8421ed585031ba4a61e06f7cb1e9c8f10.tar.xz |
torblock: Check that icanhazip.com returns an IP
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'torblock.sh')
-rwxr-xr-x | torblock.sh | 6 |
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 |