Make the second argument to routerset_contains_extendinfo const
[tor/rransom.git] / contrib / check-tor
blobe981a35fccc338a148a12f35d0c2a797c6d239c3
1 #!/bin/sh
3 ## Originally written by Peter Palfrader.
5 ## This script lets you quickly check if a given router (by nickname)
6 ## will let you do a TLS handshake, or will let you download a directory.
8 ## Usage: check-tor nickname
10 #set -x
12 router="$1"
13 dirserver="http://belegost.seul.org:80/tor/"
15 lines=$( wget -q $dirserver --proxy=off -O - | grep -A5 '^router '"$router"' ' )
16 line=$( echo "$lines" | head -n1 )
18 if [ -z "$line" ]; then
19 echo "Not found" >&2
20 exit 1
23 echo "$lines"
24 echo
26 ipor=$( echo "$line" | awk '{printf "%s:%s", $3, $4}' )
28 op=$( echo "$line" | awk '{printf $6}' )
29 ipop=$( echo "$line" | awk '{printf "%s:%s", $3, $6}' )
31 echo
32 echo ">>" openssl s_client -connect "$ipor"
33 timeout 5 openssl s_client -connect "$ipor" < /dev/null
34 if [ "$op" != "0" ]; then
35 echo
36 echo ">>" wget --proxy=off -O - http://$ipop/tor/
37 timeout 5 wget --proxy=off -O - http://$ipop/tor/ | head -n3
40 echo
41 echo -n "$router "; echo "$lines" | grep 'fingerprint' | sed -e 's/^opt //' -e 's/^fingerprint //';