Update _log_global_min_severity after switch_logs_debug(), so that USR2 will work...
[tor/rransom.git] / contrib / sd
blob8db00bd2e0dec90b8a79c93aefd5c720fa012ecf
1 #!/bin/bash
3 # Copyright (c) 2005, 2006, 2007, 2008 Peter Palfrader <peter@palfrader.org>
4 # Copyright (c) 2008 Jacob Appelbaum <jacob@appelbaum.net>
6 # Permission is hereby granted, free of charge, to any person obtaining
7 # a copy of this software and associated documentation files (the
8 # "Software"), to deal in the Software without restriction, including
9 # without limitation the rights to use, copy, modify, merge, publish,
10 # distribute, sublicense, and/or sell copies of the Software, and to
11 # permit persons to whom the Software is furnished to do so, subject to
12 # the following conditions:
14 # The above copyright notice and this permission notice shall be
15 # included in all copies or substantial portions of the Software.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 # This small script fetches information about a server when given a nickname.
26 # It currently uses the v2 dir information and not the v3 consensus by default.
27 # It requires wget, perl, awk to function properly. This is based on a zsh
28 # dotfile from weasel and adapted to be a small bash utility.
31 set -u;
32 set -e;
34 # Feel free to set any authority you desire, we're using weasel's by default
35 # You could also try the v3 directory infomation in weasel's dir authority:
36 # http://tor.noreply.org/tor/status-vote/current/consensus
38 authority="http://tor.noreply.org:80/tor/status/authority";
40 nickname="$1";
42 fp=`wget -q -O - $authority | \
43 awk '$1 == "r" && $2 == "'$nickname'" {printf "%s===", $3}' | \
44 perl -MMIME::Base64 -e "print unpack(\"H*\", decode_base64(<>)),\"\n\"";`
46 if [ "$fp" != "" ];
47 then
48 wget -q -O - http://tor.noreply.org:80/tor/server/fp/$fp;
49 exit $?;
50 else
51 echo "It appears the nickname is not currently known by the directory authority.";
52 exit 1;