From fde2f63d0c7936eb1f43bacc30585a7254a9665d Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 27 Jan 2021 11:34:23 +0100 Subject: [PATCH] Add tor hs scripts --- scripts/2021/torhs | 53 +++++++++++++++++++++++++++++++++++++ scripts/2021/torhs@.service | 7 +++++ 2 files changed, 60 insertions(+) create mode 100755 scripts/2021/torhs create mode 100644 scripts/2021/torhs@.service diff --git a/scripts/2021/torhs b/scripts/2021/torhs new file mode 100755 index 0000000..0db422f --- /dev/null +++ b/scripts/2021/torhs @@ -0,0 +1,53 @@ +#!/bin/bash + +while true; do +SOCK_PORT=$((9000+$1)) +CONTROL_PORT=$((9100+$1)) +LOCAL_PORT=$((9200+$1)) + +echo "tor daemon serv" +/usr/bin/tor \ + --hush \ + --UseEntryGuards 0 \ + --SocksPort 0 \ + --ControlPort $CONTROL_PORT \ + --DataDirectory /tmp/tor$CONTROL_PORT & + +echo "tor client serv" +/usr/bin/tor \ + --hush \ + --UseEntryGuards 0 \ + --SocksPort "127.0.0.1:$SOCK_PORT IsolateDestPort IsolateDestAddr IsolateClientAddr" \ + --DataDirectory /tmp/tor$SOCK_PORT & + +sleep 5 + +echo "measlat serv" +rm -f os_${LOCAL_PORT}.{pub,priv} +/usr/local/bin/measlat \ + -l \ + -t tor \ + -q $CONTROL_PORT \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -s 172 \ + -m torhs & + +until [ -f os_${LOCAL_PORT}.pub ]; do sleep 1; done + +echo "measlat cli" +/usr/local/bin/measlat \ + -t tor \ + -q $SOCK_PORT \ + -h $(cat os_${LOCAL_PORT}.pub).onion \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -s 172 \ + -m torhs + +kill $(jobs -p) + +sleep 5 +done diff --git a/scripts/2021/torhs@.service b/scripts/2021/torhs@.service new file mode 100644 index 0000000..5f96f5d --- /dev/null +++ b/scripts/2021/torhs@.service @@ -0,0 +1,7 @@ +[Unit] +Description=torhs + +[Service] +ExecStart=/usr/local/bin/torhs %i +WorkingDirectory=/root/torhs/ +