summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-09-11 22:12:32 +0000
committerRoger Dingledine <arma@torproject.org>2005-09-11 22:12:32 +0000
commitaa8321331f9ceeff647e9fe285e820f23c6ee039 (patch)
tree9d5b606a5e3ed3455a99130f7e9e3fca89d66c69
parent6e6f1d07daa9a882b4b49cdf5835a7959def07c3 (diff)
downloadtor-aa8321331f9ceeff647e9fe285e820f23c6ee039.tar.gz
tor-aa8321331f9ceeff647e9fe285e820f23c6ee039.zip
add weasel's check-tor script to tor/contrib/
svn:r4994
-rwxr-xr-xcontrib/check-tor41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/check-tor b/contrib/check-tor
new file mode 100755
index 0000000000..e981a35fcc
--- /dev/null
+++ b/contrib/check-tor
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+## Originally written by Peter Palfrader.
+
+## This script lets you quickly check if a given router (by nickname)
+## will let you do a TLS handshake, or will let you download a directory.
+
+## Usage: check-tor nickname
+
+#set -x
+
+router="$1"
+dirserver="http://belegost.seul.org:80/tor/"
+
+lines=$( wget -q $dirserver --proxy=off -O - | grep -A5 '^router '"$router"' ' )
+line=$( echo "$lines" | head -n1 )
+
+if [ -z "$line" ]; then
+ echo "Not found" >&2
+ exit 1
+fi
+
+echo "$lines"
+echo
+
+ipor=$( echo "$line" | awk '{printf "%s:%s", $3, $4}' )
+
+op=$( echo "$line" | awk '{printf $6}' )
+ipop=$( echo "$line" | awk '{printf "%s:%s", $3, $6}' )
+
+echo
+echo ">>" openssl s_client -connect "$ipor"
+timeout 5 openssl s_client -connect "$ipor" < /dev/null
+if [ "$op" != "0" ]; then
+ echo
+ echo ">>" wget --proxy=off -O - http://$ipop/tor/
+ timeout 5 wget --proxy=off -O - http://$ipop/tor/ | head -n3
+fi
+
+echo
+echo -n "$router "; echo "$lines" | grep 'fingerprint' | sed -e 's/^opt //' -e 's/^fingerprint //';