Dump circuits tor
This commit is contained in:
parent
b6e9772304
commit
c069e495d0
1 changed files with 40 additions and 0 deletions
40
scripts/dump_circuits
Executable file
40
scripts/dump_circuits
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
declare -A circuits
|
||||
declare -A streams
|
||||
|
||||
while read l; do
|
||||
id=$(echo $l|grep -Po '^\d+')
|
||||
circ=$(echo $l \
|
||||
| grep -Po '[^ ]*$' \
|
||||
| sed 's/,/ /g' \
|
||||
| tr -d "\r")
|
||||
#echo $id ++ ${circ[@]}
|
||||
circuits[$id]=$circ
|
||||
done <<< $( {
|
||||
nc 127.0.0.1 9051 <<EOF
|
||||
authenticate ""
|
||||
getinfo circuit-status
|
||||
quit
|
||||
EOF
|
||||
} | grep -Po '^\d+ BUILT [^ ]*' )
|
||||
|
||||
while read l; do
|
||||
id=$(echo $l \
|
||||
| grep -Po '^\d+ SUCCEEDED \d+' \
|
||||
|grep -Po '\d+$')
|
||||
url=$(echo $l \
|
||||
|grep -Po '[^ ]*$' \
|
||||
|tr -d "\r")
|
||||
streams[$id]=$url
|
||||
done <<< $( {
|
||||
nc 127.0.0.1 9051 <<EOF
|
||||
authenticate ""
|
||||
getinfo stream-status
|
||||
quit
|
||||
EOF
|
||||
} | grep -Po '^\d+ SUCCEEDED \d+ [^ ]*' )
|
||||
|
||||
for key in "${!streams[@]}"; do
|
||||
echo "${streams[$key]} --> ${circuits[$key]}"
|
||||
done
|
Loading…
Reference in a new issue