From 0fdf5bad168777969c662da01075a1440302ce12 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 27 Jan 2021 09:11:22 +0100 Subject: [PATCH] verbose + systemd services --- scripts/2021/tor1wcli | 23 +++++++++++++++++++++++ scripts/2021/tor1wcli@.service | 6 ++++++ scripts/2021/tor1wserv.service | 6 ++++++ src/meas_lat.c | 2 +- src/tor_echo.c | 2 +- src/udp_echo.c | 2 +- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100755 scripts/2021/tor1wcli create mode 100644 scripts/2021/tor1wcli@.service create mode 100644 scripts/2021/tor1wserv.service diff --git a/scripts/2021/tor1wcli b/scripts/2021/tor1wcli new file mode 100755 index 0000000..589f311 --- /dev/null +++ b/scripts/2021/tor1wcli @@ -0,0 +1,23 @@ +#!/bin/bash + +while true; do +SOCK_PORT=$1 +/usr/bin/tor \ + --UseEntryGuards 0 \ + --SocksPort "127.0.0.1:$SOCK_PORT IsolateDestPort IsolateDestAddr IsolateClientAddr" \ + --DataDirectory /tmp/tor$SOCK_PORT & + +sleep 5 + +/usr/local/bin/measlat \ + -t tor \ + -q $SOCK_PORT \ + -h rayonx.machine.deuxfleurs.fr \ + -p 443 \ + -c 135000 \ + -i 40 \ + -s 172 \ + -m tor1w + +kill $! +done diff --git a/scripts/2021/tor1wcli@.service b/scripts/2021/tor1wcli@.service new file mode 100644 index 0000000..11ed9a4 --- /dev/null +++ b/scripts/2021/tor1wcli@.service @@ -0,0 +1,6 @@ +[Unit] +Description=tor1wcli + +[Service] +ExecStart=/usr/local/bin/tor1wcli %i +WorkingDirectory=/root/tor1wcli/ diff --git a/scripts/2021/tor1wserv.service b/scripts/2021/tor1wserv.service new file mode 100644 index 0000000..27fccb3 --- /dev/null +++ b/scripts/2021/tor1wserv.service @@ -0,0 +1,6 @@ +[Unit] +Description=tor1wserv + +[Service] +ExecStart=/usr/local/bin/measlat -l -t tcp -p 443 -c 135000 -i 40 -s 172 -m tor1w +WorkingDirectory=/root/tor1wserv/ diff --git a/src/meas_lat.c b/src/meas_lat.c index d860ac8..6175934 100644 --- a/src/meas_lat.c +++ b/src/meas_lat.c @@ -303,7 +303,7 @@ int on_socks5_failed_measlat(struct evt_core_ctx* ctx, struct evt_core_fdinfo* f void register_categories(struct evt_core_ctx* evts, struct measlat_ctx* mctx) { struct evt_core_cat template = {0}; template.app_ctx = mctx; - evt_core_init(evts, mctx->verbose); + evt_core_init(evts, mctx->verbose <= 0 ? 0 : mctx->verbose - 1); template.cb = on_timer; template.name = "timer"; diff --git a/src/tor_echo.c b/src/tor_echo.c index 3b1a200..35a7b18 100644 --- a/src/tor_echo.c +++ b/src/tor_echo.c @@ -150,7 +150,7 @@ int main(int argc, char** argv) { }; measure_state_init (&tctx.mp, &tctx.ms); - evt_core_init(&evts, tctx.verbose); + evt_core_init(&evts, tctx.verbose <= 0 ? 0 : tctx.verbose - 1); evt_core_add_cat(&evts, &tcp_co); evt_core_add_cat(&evts, &tcp_all); printf("--- Categories created\n"); diff --git a/src/udp_echo.c b/src/udp_echo.c index f1e2f7a..655f7b3 100644 --- a/src/udp_echo.c +++ b/src/udp_echo.c @@ -85,7 +85,7 @@ int main(int argc, char** argv) { .flags = EPOLLIN | EPOLLET, .socklist = NULL }; - evt_core_init(&evts, uctx.verbose); + evt_core_init(&evts, uctx.verbose <= 0 ? 0 : uc tx.verbose - 1); evt_core_add_cat(&evts, &udp_read); // 3. Register UDP socket