tor_multipath_voip/scripts/2021/torfone

92 lines
1.9 KiB
Text
Raw Normal View History

2021-01-27 15:44:15 +00:00
#!/bin/bash
2021-01-27 16:56:29 +00:00
red() { IFS= ; while read -r line; do echo -e '\e[31m'$line'\e[0m'; done; }
green() { IFS= ; while read -r line; do echo -e '\e[32m'$line'\e[0m'; done; }
yellow() { IFS= ; while read -r line; do echo -e '\e[33m'$line'\e[0m'; done; }
blue() { IFS= ; while read -r line; do echo -e '\e[34m'$line'\e[0m'; done; }
purple() { IFS= ; while read -r line; do echo -e '\e[35m'$line'\e[0m'; done; }
cyan() { IFS= ; while read -r line; do echo -e '\e[36m'$line'\e[0m'; done; }
2021-01-27 15:44:15 +00:00
SOCK_PORT=$((9000+$1))
CONTROL_PORT=$((9100+$1))
LOCAL_PORT=$((9200+$1))
DONAR_PORT=$((7000+$1*12))
2021-01-27 16:56:29 +00:00
while true; do
2021-01-27 15:44:15 +00:00
touch /tmp/empty
/usr/bin/tor \
-f /tmp/empty --defaults-torrc /tmp/empty \
--hush \
--UseEntryGuards 0 \
--SocksPort 0 \
--ControlPort $CONTROL_PORT \
2021-01-27 16:56:29 +00:00
--DataDirectory /tmp/tor$CONTROL_PORT | red &
2021-01-27 15:44:15 +00:00
sleep 1
/usr/bin/tor \
-f /tmp/empty --defaults-torrc /tmp/empty \
--hush \
--UseEntryGuards 0 \
--SocksPort "127.0.0.1:$SOCK_PORT IsolateDestPort IsolateDestAddr IsolateClientAddr" \
2021-01-27 16:56:29 +00:00
--DataDirectory /tmp/tor$SOCK_PORT | green &
2021-01-27 15:44:15 +00:00
sleep 1
rm -rf state_$LOCAL_PORT/
mkdir state_$LOCAL_PORT/
pushd .
cd state_$LOCAL_PORT/
/usr/local/bin/donar \
-s \
-a dup2 \
-q $CONTROL_PORT \
-k $DONAR_PORT \
-l 2 \
2021-01-27 16:56:29 +00:00
-b \
-e $LOCAL_PORT 2>&1 | yellow &
2021-01-27 15:44:15 +00:00
sleep 1
/usr/local/bin/donar \
-c \
-a dup2 \
-q $SOCK_PORT \
-k $DONAR_PORT \
-o ./onion_services.pub \
-l 2 \
2021-01-27 16:56:29 +00:00
-b \
-r $LOCAL_PORT 2>&1 | blue &
2021-01-27 15:44:15 +00:00
sleep 1
popd
/usr/local/bin/measlat \
-l \
-t udp \
-h 127.0.0.1 \
-p $LOCAL_PORT \
2021-01-27 20:44:26 +00:00
-c 135000 \
2021-01-27 15:44:15 +00:00
-i 40 \
2021-01-27 16:56:29 +00:00
-m torfone \
-s 172 2>&1 | cyan &
2021-01-27 15:44:15 +00:00
sleep 1
/usr/local/bin/measlat \
-t udp \
-h 127.13.3.7 \
-p $LOCAL_PORT \
-b \
-c 1 \
2021-01-27 16:56:29 +00:00
-i 5000 \
-m torfone \
-s 172 2>&1 | purple
2021-01-27 15:44:15 +00:00
/usr/local/bin/measlat \
-t udp \
-h 127.13.3.7 \
-p $LOCAL_PORT \
2021-01-27 20:44:26 +00:00
-c 135000 \
2021-01-27 15:44:15 +00:00
-i 40 \
2021-01-27 16:56:29 +00:00
-m torfone \
-s 172 2>&1 | purple
2021-01-27 15:44:15 +00:00
2021-01-27 16:56:29 +00:00
kill $(jobs -p)
done