From 36aa674a3ebcdad074123d7ca7c414dc0da4fa60 Mon Sep 17 00:00:00 2001 From: MustangGB Date: Thu, 22 Apr 2021 21:35:00 +0100 Subject: [PATCH] Improve reliability of CookieAuth use with hexdump --- torproxy.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torproxy.sh b/torproxy.sh index d7f6ccd..836a81a 100755 --- a/torproxy.sh +++ b/torproxy.sh @@ -63,9 +63,8 @@ hidden_service() { local port="$1" host="$2" file=/etc/tor/torrc # N/A) # Return: New circuits for tor connections newnym() { local file=/etc/tor/run/control.authcookie - echo -e 'AUTHENTICATE "'"$(cat $file)"'"\nSIGNAL NEWNYM\nQUIT' | + echo -e 'AUTHENTICATE '"$(hexdump -e '32/1 "%02x""\n"' $file)"'\nSIGNAL NEWNYM\nQUIT' | nc 127.0.0.1 9051 - if ps -ef | egrep -v 'grep|torproxy.sh' | grep -q tor; then exit 0; fi } ### password: setup a hashed password @@ -156,4 +155,4 @@ else cat /srv/tor/hidden_service/hostname; echo; } /usr/sbin/privoxy --user privoxy /etc/privoxy/config exec /usr/bin/tor -fi \ No newline at end of file +fi