From d42f458e842eb566a240f706b3c526d414935fde Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 22 Oct 2019 17:42:20 +0200 Subject: [PATCH] WIP bash VoIP clients --- Dockerfile | 2 +- r/lightning_begin.R | 14 +++--- scripts/{ => container}/lightning-client | 0 scripts/{ => container}/lightning-server | 0 scripts/{ => container}/naive-client | 0 scripts/{ => container}/naive-server | 0 scripts/{ => container}/orig-client | 0 scripts/{ => container}/orig-server | 0 scripts/{ => container}/orig-server-single | 0 scripts/container/start_client | 58 ++++++++++++++++++++++ scripts/container/start_server | 57 +++++++++++++++++++++ scripts/{ => container}/thunder-client | 0 scripts/{ => container}/thunder-server | 0 13 files changed, 123 insertions(+), 8 deletions(-) rename scripts/{ => container}/lightning-client (100%) rename scripts/{ => container}/lightning-server (100%) rename scripts/{ => container}/naive-client (100%) rename scripts/{ => container}/naive-server (100%) rename scripts/{ => container}/orig-client (100%) rename scripts/{ => container}/orig-server (100%) rename scripts/{ => container}/orig-server-single (100%) create mode 100755 scripts/container/start_client create mode 100755 scripts/container/start_server rename scripts/{ => container}/thunder-client (100%) rename scripts/{ => container}/thunder-server (100%) diff --git a/Dockerfile b/Dockerfile index 88212e4..9210fad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,5 +63,5 @@ COPY --from=builder /home/donar-build/out/udpecho /usr/local/bin COPY --from=builder /home/donar-build/out/torecho /usr/local/bin COPY --from=builder /home/donar-build/tor2/src/app/tor /usr/local/bin/tor2 COPY --from=builder /home/donar-build/tor3/src/app/tor /usr/local/bin/tor3 -COPY ./scripts/* /usr/local/bin/ +COPY ./scripts/container/* /usr/local/bin/ COPY ./torrc_* /etc/ diff --git a/r/lightning_begin.R b/r/lightning_begin.R index a80bed0..9d2d0ed 100644 --- a/r/lightning_begin.R +++ b/r/lightning_begin.R @@ -10,7 +10,7 @@ ggplot(data=link_info, aes(x=timestamp, y=link, color=speed)) + theme_classic() -xx <- read.csv("../../donar-res/tmp_light/ae.csv") +xx <- read.csv("../../donar-res/tmp_light/v2.csv") xx2 <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way from xx group by packet_id,way") ggplot(data=xx2, aes(x=packet_id, y=lat, color=way)) + geom_line() + @@ -68,7 +68,7 @@ ggplot(data=xx3, aes(x=lat, group=flag, color=flag)) + coord_cartesian(xlim=c(0,1200)) + theme_classic() -xy <- read.csv("../../donar-res/tmp_light/aa.csv") +xy <- read.csv("../../donar-res/tmp_light/light.csv") xz <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run") xz$conf <- factor(xz$conf) ggplot(data=xz, aes(x=lat, group=conf, color=conf)) + @@ -83,8 +83,8 @@ ggplot(data=xz, aes(y=lat, x=conf)) + geom_boxplot(width=0.1, outlier.shape=NA) + theme_classic() -xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy where flag=1 and packet_id > 50 and packet_id < 7400 group by packet_id,way,conf,run") -ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x=packet_id, y=lat, color=way)) + +xa <- sqldf("select packet_id,1.0 * MIN(latency) / 1000.0 as lat,way,conf,run from xy group by packet_id,way,conf,run") +ggplot(data=sqldf("select * from xa where run='L6woUXrfE3XkJLyt-0'"), aes(x=packet_id, y=lat, color=way)) + geom_line() + geom_hline(yintercept=400) + geom_hline(yintercept=200) + @@ -92,10 +92,10 @@ ggplot(data=sqldf("select * from xa where run='out/bhTF0rd7MOI5SOPs-6'"), aes(x= #geom_point(aes(shape=conf)) + theme_classic() -xb <- read.csv("../../donar-res/tmp_light/ae.csv") +xb <- read.csv("../../donar-res/tmp_light/v1.csv") xb$flag <- factor(xb$flag) xb$link_id <- factor(xb$link_id) -xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 0") +xc <- sqldf("select *, 1.0 * latency / 1000.0 as lat from xb where vanilla = 1 and link_id = 5") ggplot(data=xc, aes(x=packet_id, y=lat, color=link_id:way)) + coord_cartesian(ylim=c(100,600)) + geom_line() + @@ -137,7 +137,7 @@ ggplot(data=xd, aes(x=packet_id, y=lat, color=link_id)) + geom_line() + theme_classic() -ggplot(data=sqldf("select * from xb where vanilla = 1 and way= 'server'"), aes(x=packet_id, y=link_id, color=flag)) + +ggplot(data=sqldf("select * from xb where vanilla = 1 and way= 'client'"), aes(x=packet_id, y=link_id, color=flag)) + geom_point() + theme_classic() diff --git a/scripts/lightning-client b/scripts/container/lightning-client similarity index 100% rename from scripts/lightning-client rename to scripts/container/lightning-client diff --git a/scripts/lightning-server b/scripts/container/lightning-server similarity index 100% rename from scripts/lightning-server rename to scripts/container/lightning-server diff --git a/scripts/naive-client b/scripts/container/naive-client similarity index 100% rename from scripts/naive-client rename to scripts/container/naive-client diff --git a/scripts/naive-server b/scripts/container/naive-server similarity index 100% rename from scripts/naive-server rename to scripts/container/naive-server diff --git a/scripts/orig-client b/scripts/container/orig-client similarity index 100% rename from scripts/orig-client rename to scripts/container/orig-client diff --git a/scripts/orig-server b/scripts/container/orig-server similarity index 100% rename from scripts/orig-server rename to scripts/container/orig-server diff --git a/scripts/orig-server-single b/scripts/container/orig-server-single similarity index 100% rename from scripts/orig-server-single rename to scripts/container/orig-server-single diff --git a/scripts/container/start_client b/scripts/container/start_client new file mode 100755 index 0000000..f93c604 --- /dev/null +++ b/scripts/container/start_client @@ -0,0 +1,58 @@ +#!/bin/bash +LPORT="${NLINKS:-9000}" +RPORT="${NLINKS:-9000}" +NLINKS="${NLINKS:-16}" +SCHED="${SCHED:-tick_tock=0}" +LOGS="/tmp/donar_log" +mkdir -p $LOGS +echo "[+] Log folder is $LOGS" + +tor2 -f /etc/torrc_simple > $LOGS/tor.stdout 2> $LOGS/tor.stderr & +echo "[+] Started Tor" +sleep 2 + +echo "[+] Please enter links and finish with an empty line" +while read -r $line; do + [ -z "$line" ] && break + echo $line >> onion_services.pub +done + +donar \ + -a lightning \ + -c \ + -o onion_services.pub \ + -l $NLINKS \ + -p $SCHED \ + -b \ + -e $LPORT \ + -r $RPORT \ +> $LOGS/client-donar-stdout.log 2> $LOGS/client-donar-stderr.log & +echo "[+] Started Donar. Local port is $LPORT, remote port is $RPORT." + +gst-launch-1.0 \ + autoaudiosrc ! \ + webrtcdsp ! \ + queue ! \ + audioresample ! \ + opusenc audio-type=voice inband-fec=FALSE frame-size=40 bitrate=32000 dtx=TRUE ! \ + rtpopuspay ! \ + udpsink host=127.13.3.7 port=9000 async=FALSE \ + udpsrc port=9000 caps="application/x-rtp" ! \ + rtpjitterbuffer do-lost=TRUE do-retransmission=FALSE latency=10 ! \ + rtpopusdepay ! \ + opusdec plc=TRUE use-inband-fec=FALSE ! \ + audioresample ! \ + webrtcechoprobe ! \ + autoaudiosink > $LOGS/gstreamer.stdout 2> $LOGS/gstreamer.stderr & +echo "[+] Started GStreamer" + +echo "[+] Waiting for connections" +connections=0 +while [ $connections -ne $NLINKS ]; do + sleep 1 + connections=$(grep 'Succeeded,' $LOGS/client-donar-stdout.log | wc -l) + echo -ne "Connecting: $connections/$NLINKS%\033[0K\r" +done +echo "Ready" + +echo "[+] Let's rocks!" diff --git a/scripts/container/start_server b/scripts/container/start_server new file mode 100755 index 0000000..f63a3a7 --- /dev/null +++ b/scripts/container/start_server @@ -0,0 +1,57 @@ +#!/bin/bash +LPORT="${NLINKS:-9000}" +RPORT="${NLINKS:-9000}" +NLINKS="${NLINKS:-16}" +SCHED="${SCHED:-tick_tock=0}" +LOGS="/tmp/donar_log" +mkdir -p $LOGS +echo "[+] Log folder is $LOGS" + +tor2 -f /etc/torrc_simple > $LOGS/tor.stdout 2> $LOGS/tor.stderr & +echo "[+] Started Tor" +sleep 2 + +donar \ + -a lightning \ + -s \ + -l $NLINKS \ + -p $SCHED \ + -b \ + -e $LPORT \ + -r $RPORT \ +> $LOGS/server-donar-stdout.log 2> $LOGS/server-donar-stderr.log & +echo "[+] Started Donar. Local port is $LPORT, remote port is $RPORT." + +until [ -f onion_services.pub ]; do sleep 1; done +echo "--- Please forward the following addresses: ---" +cat onion_services.pub +echo "" +echo "------" + +gst-launch-1.0 \ + autoaudiosrc ! \ + webrtcdsp ! \ + queue ! \ + audioresample ! \ + opusenc audio-type=voice inband-fec=FALSE frame-size=40 bitrate=32000 dtx=TRUE ! \ + rtpopuspay ! \ + udpsink host=127.13.3.7 port=9000 async=FALSE \ + udpsrc port=9000 caps="application/x-rtp" ! \ + rtpjitterbuffer do-lost=TRUE do-retransmission=FALSE latency=10 ! \ + rtpopusdepay ! \ + opusdec plc=TRUE use-inband-fec=FALSE ! \ + audioresample ! \ + webrtcechoprobe ! \ + autoaudiosink > $LOGS/gstreamer.stdout 2> $LOGS/gstreamer.stderr & +echo "[+] Started GStreamer" + +echo "[+] Waiting for connections" +connections=0 +while [ $connections -ne $NLINKS ]; do + sleep 1 + connections=$(grep 'Succeeded,' $LOGS/server-donar-stdout.log | wc -l) + echo -ne "Connecting: $connections/$NLINKS%\033[0K\r" +done +echo "Ready" + +echo "[+] Let's rocks!" diff --git a/scripts/thunder-client b/scripts/container/thunder-client similarity index 100% rename from scripts/thunder-client rename to scripts/container/thunder-client diff --git a/scripts/thunder-server b/scripts/container/thunder-server similarity index 100% rename from scripts/thunder-server rename to scripts/container/thunder-server