From 26d80225a6cf8b895fb3e3f8ab3f4a86b0945697 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:27:47 +0200 Subject: [PATCH 01/10] Use ngrok service --- setup.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setup.sh b/setup.sh index 6243b4f..c53e8ee 100755 --- a/setup.sh +++ b/setup.sh @@ -63,6 +63,18 @@ else server="eu" fi +echo "Installing ngrok service" +ngrokconf=\ +"version: \"2\"\n\ +authtoken: $user_authtoken\n\ +region: $server\n\ +tunnels:\n\ + ssh:\n\ + proto: tcp\n\ + addr: $ngrok_port" +echo -e "$ngrokconf" > ngrok.yml +command="${DIR}/ngrok service install --config ngrok.yml" + printf "dweet_id_tunnel=${d_id_tun}\nport=${ngrok_port}\ntunnel_delay=${tun_delay}\nngrok_server=${server}" > config.cfg echo "Adding Cron job..." From 9165bbbd006b1a0b6e2975cbb95cd189c5ebbe11 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:28:22 +0200 Subject: [PATCH 02/10] Remove ngrok as it is now started as a service --- nomohead.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/nomohead.sh b/nomohead.sh index 1eeecd4..09c1ca1 100755 --- a/nomohead.sh +++ b/nomohead.sh @@ -12,13 +12,6 @@ fi . "${DIR}/config.cfg" -echo "Starting ngrok..." - -#Creates command to run ngrok using defined directory in setup.sh (Eg: ~/Downloads/ngrok) -COMMAND=("${DIR}/ngrok" tcp -region "${ngrok_server}" "${port}") - -"${COMMAND[@]}" > /dev/null & - #Sleeps for delay defined in setup.sh sleep $tunnel_delay From b208eb7e4f235733913a2ae7fef825086b2ec8c2 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:37:31 +0200 Subject: [PATCH 03/10] Fix download links for ngrok v3 --- setup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index c53e8ee..8682526 100755 --- a/setup.sh +++ b/setup.sh @@ -15,13 +15,13 @@ if [ $? != 0 ]; then download="" zip="" case $(uname -m) in - i386) download="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-386.zip" && zip="ngrok-stable-linux-386.zip" && echo "Downloading archive for x86 Linux" ;; - i686) download="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-386.zip" && zip="ngrok-stable-linux-386.zip" && echo "Downloading archive for x86 Linux" ;; - x86_64) download="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip" && zip="ngrok-stable-linux-amd64.zip" && echo "Downloading archive for x86_64 Linux" ;; - arm) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm64.zip" && zip="ngrok-stable-linux-arm64.zip" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip" && zip="ngrok-stable-arm.zip" && echo "Downloading archive for arm32 Linux" ;; + i386) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; + i686) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; + x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; + arm) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac wget "$download" - unzip "$zip" 1> /dev/null & + tar-xf "$tgz" echo "Download and extraction of ngrok executable complete" else echo "ngrok executable found!" From 036b6fdc98ea914a35a939c831c0c8fb7eee9efc Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:42:16 +0200 Subject: [PATCH 04/10] Fix ? --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 8682526..afb1dde 100755 --- a/setup.sh +++ b/setup.sh @@ -18,7 +18,7 @@ if [ $? != 0 ]; then i386) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; i686) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; - arm) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; + arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac wget "$download" tar-xf "$tgz" From 5b3ce5f87be2179bac5b7401e5a4df85e1b29fd5 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:46:45 +0200 Subject: [PATCH 05/10] Fix download file name --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index afb1dde..110ddc4 100755 --- a/setup.sh +++ b/setup.sh @@ -20,7 +20,7 @@ if [ $? != 0 ]; then x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac - wget "$download" + wget "$download -o $tgz" tar-xf "$tgz" echo "Download and extraction of ngrok executable complete" else @@ -69,7 +69,7 @@ ngrokconf=\ authtoken: $user_authtoken\n\ region: $server\n\ tunnels:\n\ - ssh:\n\ + nomohead:\n\ proto: tcp\n\ addr: $ngrok_port" echo -e "$ngrokconf" > ngrok.yml From 71ad44b58d4c288f52947eb8873ed6dedabeb3b3 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:49:39 +0200 Subject: [PATCH 06/10] Fix wget --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 110ddc4..ad3a852 100755 --- a/setup.sh +++ b/setup.sh @@ -20,7 +20,7 @@ if [ $? != 0 ]; then x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac - wget "$download -o $tgz" + wget "$download" -o "$tgz" tar-xf "$tgz" echo "Download and extraction of ngrok executable complete" else From 9db74b5f863215f953fac23394af5e94c7f1e762 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:50:26 +0200 Subject: [PATCH 07/10] Fix tar command --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index ad3a852..3f5855a 100755 --- a/setup.sh +++ b/setup.sh @@ -21,7 +21,7 @@ if [ $? != 0 ]; then arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac wget "$download" -o "$tgz" - tar-xf "$tgz" + tar -xf "$tgz" echo "Download and extraction of ngrok executable complete" else echo "ngrok executable found!" From 09590bc268fb1390ba971eada52cda2995146cd9 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 11:52:39 +0200 Subject: [PATCH 08/10] Fix tar command --- setup.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index 3f5855a..33ef3c5 100755 --- a/setup.sh +++ b/setup.sh @@ -15,14 +15,16 @@ if [ $? != 0 ]; then download="" zip="" case $(uname -m) in - i386) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; - i686) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; - x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; - arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-stable-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; + i386) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-v3-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; + i686) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-386.tgz" && tgz="ngrok-v3-stable-linux-386.tgz" && echo "Downloading archive for x86 Linux" ;; + x86_64) download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz" && tgz="ngrok-v3-stable-linux-amd64.tgz" && echo "Downloading archive for x86_64 Linux" ;; + arm*) dpkg --print-architecture | grep -q "arm64" && download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm64.tgz" && tgz="ngrok-v3-stable-linux-arm64.tgz" && echo "Downloading archive for arm64 Linux" || download="https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz" && tgz="ngrok-v3-stable-linux-arm.tgz" && echo "Downloading archive for arm32 Linux" ;; esac - wget "$download" -o "$tgz" + wget "$download" tar -xf "$tgz" echo "Download and extraction of ngrok executable complete" + echo "Removing archive..." + rm "$tgz" else echo "ngrok executable found!" fi From 40e4fafbe06aa4c7b15bd33130fb951a0b7bc2fe Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 12:00:10 +0200 Subject: [PATCH 09/10] Verify that root is used --- setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.sh b/setup.sh index 33ef3c5..affa5fb 100755 --- a/setup.sh +++ b/setup.sh @@ -2,6 +2,8 @@ echo -e "\e[1m\e[44mWelcome to nomohead's setup script! \e[0m" +[[ $EUID -ne 0 ]] && echo "This script must be run as root." && exit 1 + echo "" echo "Testing to see if ngrok is contained inside this folder..." From 59c7915c018da499047b4d95fa9ea1c6de0994f3 Mon Sep 17 00:00:00 2001 From: Ectalite Date: Tue, 28 Mar 2023 12:07:23 +0200 Subject: [PATCH 10/10] Add time to dweet report --- nomohead.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nomohead.sh b/nomohead.sh index 09c1ca1..b9afdc3 100755 --- a/nomohead.sh +++ b/nomohead.sh @@ -28,8 +28,10 @@ do echo "${TUNNEL}" > tunnel_info.json #Gets the tunnel's address and port TUNNEL_TCP=$(grep -Po 'tcp:\/\/[^"]+' ./tunnel_info.json ) + + TIME=$(date +"Update: %T || %m-%d-%y") #Pushes all this information to dweet.io - curl -d "tunnel=${TUNNEL_TCP}&internal_ip=${IP}&external_ip=${EXTERNALIP}" http://dweet.io/dweet/for/${dweet_id_tunnel} + curl -d "tunnel=${TUNNEL_TCP}&internal_ip=${IP}&external_ip=${EXTERNALIP}&time=${TIME}" http://dweet.io/dweet/for/${dweet_id_tunnel} sleep $tunnel_delay done