diff --git a/scripts/2021/.gitignore b/scripts/2021/.gitignore new file mode 100644 index 0000000..e053227 --- /dev/null +++ b/scripts/2021/.gitignore @@ -0,0 +1,4 @@ +.swrc +*.swp +.terraform/* +*.lock.hcl diff --git a/scripts/2021/donaraltna b/scripts/2021/donaraltna new file mode 100755 index 0000000..517b934 --- /dev/null +++ b/scripts/2021/donaraltna @@ -0,0 +1,101 @@ +#!/bin/bash + +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; } + +SOCK_PORT=$((9000+$1)) +CONTROL_PORT=$((9100+$1)) +LOCAL_PORT=$((9200+$1)) +DONAR_PORT=$((7000+$1*12)) + +while true; do +touch /tmp/empty +rm -rf /tmp/tor$CONTROL_PORT +/usr/bin/tor \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --hush \ + --UseEntryGuards 0 \ + --SocksPort 0 \ + --ControlPort $CONTROL_PORT \ + --HiddenServiceNonAnonymousMode 1 \ + --HiddenServiceSingleHopMode 1 \ + --DataDirectory /tmp/tor$CONTROL_PORT | red & +sleep 1 + +rm -rf /tmp/tor$SOCK_PORT +/usr/bin/tor \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --hush \ + --UseEntryGuards 1 \ + --NumEntryGuards 2 \ + --NumPrimaryGuards 2 \ + --SocksPort "127.0.0.1:$SOCK_PORT IsolateDestPort IsolateDestAddr IsolateClientAddr" \ + --DataDirectory /tmp/tor$SOCK_PORT | green & +sleep 1 + +rm -rf state_$LOCAL_PORT/ +mkdir state_$LOCAL_PORT/ +pushd . +cd state_$LOCAL_PORT/ +/usr/local/bin/donar \ + -s \ + -a lightning \ + -q $CONTROL_PORT \ + -k $DONAR_PORT \ + -l 12 \ + -p 'fast_count=3!tick_tock=1!measlat=0!window=2000' \ + -b \ + -n \ + -e $LOCAL_PORT 2>&1 | yellow & +sleep 1 + +/usr/local/bin/donar \ + -c \ + -a lightning \ + -q $SOCK_PORT \ + -k $DONAR_PORT \ + -o ./onion_services.pub \ + -l 12 \ + -p 'fast_count=3!tick_tock=1!measlat=0!window=2000' \ + -b \ + -r $LOCAL_PORT 2>&1 | blue & +sleep 1 +popd + +/usr/local/bin/measlat \ + -l \ + -t udp \ + -h 127.0.0.1 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m donaraltna \ + -s 172 2>&1 | cyan & +sleep 1 + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -b \ + -c 1 \ + -i 5000 \ + -m donaraltna \ + -s 172 2>&1 | purple + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m donaraltna \ + -s 172 2>&1 | purple + +kill -9 $(jobs -p) +sleep 5 +done diff --git a/scripts/2021/donardupna b/scripts/2021/donardupna new file mode 100755 index 0000000..3f8a581 --- /dev/null +++ b/scripts/2021/donardupna @@ -0,0 +1,101 @@ +#!/bin/bash + +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; } + +SOCK_PORT=$((9000+$1)) +CONTROL_PORT=$((9100+$1)) +LOCAL_PORT=$((9200+$1)) +DONAR_PORT=$((7000+$1*12)) + +while true; do +touch /tmp/empty +rm -rf /tmp/tor$CONTROL_PORT +/usr/bin/tor \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --hush \ + --UseEntryGuards 0 \ + --SocksPort 0 \ + --ControlPort $CONTROL_PORT \ + --HiddenServiceNonAnonymousMode 1 \ + --HiddenServiceSingleHopMode 1 \ + --DataDirectory /tmp/tor$CONTROL_PORT | red & +sleep 1 + +rm -rf /tmp/tor$SOCK_PORT +/usr/bin/tor \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --hush \ + --UseEntryGuards 1 \ + --NumEntryGuards 2 \ + --NumPrimaryGuards 2 \ + --SocksPort "127.0.0.1:$SOCK_PORT IsolateDestPort IsolateDestAddr IsolateClientAddr" \ + --DataDirectory /tmp/tor$SOCK_PORT | green & +sleep 1 + +rm -rf state_$LOCAL_PORT/ +mkdir state_$LOCAL_PORT/ +pushd . +cd state_$LOCAL_PORT/ +/usr/local/bin/donar \ + -s \ + -a lightning \ + -q $CONTROL_PORT \ + -k $DONAR_PORT \ + -l 12 \ + -p 'fast_count=3!tick_tock=0!measlat=0!window=2000' \ + -b \ + -n \ + -e $LOCAL_PORT 2>&1 | yellow & +sleep 1 + +/usr/local/bin/donar \ + -c \ + -a lightning \ + -q $SOCK_PORT \ + -k $DONAR_PORT \ + -o ./onion_services.pub \ + -l 12 \ + -p 'fast_count=3!tick_tock=0!measlat=0!window=2000' \ + -b \ + -r $LOCAL_PORT 2>&1 | blue & +sleep 1 +popd + +/usr/local/bin/measlat \ + -l \ + -t udp \ + -h 127.0.0.1 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m donardupna \ + -s 172 2>&1 | cyan & +sleep 1 + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -b \ + -c 1 \ + -i 5000 \ + -m donardupna \ + -s 172 2>&1 | purple + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m donardupna \ + -s 172 2>&1 | purple + +kill -9 $(jobs -p) +sleep 5 +done diff --git a/scripts/2021/install.sh b/scripts/2021/install.sh new file mode 100755 index 0000000..bd4db02 --- /dev/null +++ b/scripts/2021/install.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cd /usr/local/bin/ + +for bin in donar measlat tor2 tor3 torecho udpecho; do + wget https://gitlab.inria.fr/qdufour/donar/-/raw/master/dist/${bin}?inline=false -O ${bin} +done + +for scr in donaralt donaraltna donaraltopt donardup donardupopt tor1wcli tor2wcli torfone torfoneopt torhs torhsopt; do + wget https://gitlab.inria.fr/qdufour/donar/-/raw/master/scripts/2021/${scr}?inline=false -O ${scr} +done + + diff --git a/scripts/2021/main.tf b/scripts/2021/main.tf new file mode 100644 index 0000000..a7890c0 --- /dev/null +++ b/scripts/2021/main.tf @@ -0,0 +1,22 @@ +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + version = "2.0.0-rc1" + } + } +} + +provider "scaleway" { + zone = "fr-par-1" + region = "fr-par" +} + +resource "scaleway_instance_server" "torhs" { + type = "DEV1-L" + image = "ubuntu_focal" + + user_data { + cloud-init = file("${path.module}/torhs.yml") + } +} diff --git a/scripts/2021/torfonena b/scripts/2021/torfonena new file mode 100755 index 0000000..cf93185 --- /dev/null +++ b/scripts/2021/torfonena @@ -0,0 +1,95 @@ +#!/bin/bash + +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; } + +SOCK_PORT=$((9000+$1)) +CONTROL_PORT=$((9100+$1)) +LOCAL_PORT=$((9200+$1)) +DONAR_PORT=$((7000+$1*12)) + +while true; do +touch /tmp/empty +/usr/bin/tor \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --hush \ + --UseEntryGuards 0 \ + --SocksPort 0 \ + --ControlPort $CONTROL_PORT \ + --HiddenServiceNonAnonymousMode 1 \ + --HiddenServiceSingleHopMode 1 \ + --DataDirectory /tmp/tor$CONTROL_PORT | red & +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" \ + --DataDirectory /tmp/tor$SOCK_PORT | green & +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 \ + -n \ + -b \ + -e $LOCAL_PORT 2>&1 | yellow & +sleep 1 + +/usr/local/bin/donar \ + -c \ + -a dup2 \ + -q $SOCK_PORT \ + -k $DONAR_PORT \ + -o ./onion_services.pub \ + -l 2 \ + -b \ + -r $LOCAL_PORT 2>&1 | blue & +sleep 1 +popd + +/usr/local/bin/measlat \ + -l \ + -t udp \ + -h 127.0.0.1 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m torfonena \ + -s 172 2>&1 | cyan & +sleep 1 + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -b \ + -c 1 \ + -i 5000 \ + -m torfonena \ + -s 172 2>&1 | purple + +/usr/local/bin/measlat \ + -t udp \ + -h 127.13.3.7 \ + -p $LOCAL_PORT \ + -c 135000 \ + -i 40 \ + -m torfonena \ + -s 172 2>&1 | purple + +kill -9 $(jobs -p) +sleep 5 +done diff --git a/scripts/2021/torhs.yml b/scripts/2021/torhs.yml new file mode 100644 index 0000000..943b49a --- /dev/null +++ b/scripts/2021/torhs.yml @@ -0,0 +1,4 @@ +runcmd: + - + +final_message: "done" diff --git a/scripts/2021/torhsna b/scripts/2021/torhsna new file mode 100755 index 0000000..8101db3 --- /dev/null +++ b/scripts/2021/torhsna @@ -0,0 +1,57 @@ +#!/bin/bash + +while true; do +SOCK_PORT=$((9000+$1)) +CONTROL_PORT=$((9100+$1)) +LOCAL_PORT=$((9200+$1)) + +echo "tor daemon serv" +touch /tmp/empty +/usr/local/bin/tor3 \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --UseEntryGuards 0 \ + --SocksPort 0 \ + --ControlPort $CONTROL_PORT \ + --HiddenServiceNonAnonymousMode 1 \ + --HiddenServiceSingleHopMode 1 \ + --DataDirectory /tmp/tor$CONTROL_PORT & + +echo "tor client serv" +/usr/local/bin/tor3 \ + -f /tmp/empty --defaults-torrc /tmp/empty \ + --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 \ + -n \ + -m torhsna & + +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 torhsna + +kill -9 $(jobs -p) + +sleep 5 +done diff --git a/scripts/2021/torhsna@.service b/scripts/2021/torhsna@.service new file mode 100644 index 0000000..9920ffe --- /dev/null +++ b/scripts/2021/torhsna@.service @@ -0,0 +1,7 @@ +[Unit] +Description=torhsna + +[Service] +ExecStart=/usr/local/bin/torhsna %i +WorkingDirectory=/root/torhsna/ +