Initial commit. - bitreich-gaming-link - bitreich-gaming-link Simple game linking using unix tools.
(HTM) git clone git://bitreich.org/bitreich-gaming-link git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-gaming-link
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
---
(DIR) commit 408473b22e310ef6cc35fa850c042d3a73e8fd77
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 23 Mar 2024 19:34:08 +0100
Initial commit.
Diffstat:
A tcp-ssh-reverse-tunnel | 17 +++++++++++++++++
A udp-ssh-reverse-tunnel | 26 ++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/tcp-ssh-reverse-tunnel b/tcp-ssh-reverse-tunnel
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+if [ $# -lt 3 ];
+then
+ printf "usage: %s user@sshserver localport remoteport\n" \
+ "$(basename "$0")" >&2
+ exit 1
+fi
+
+sshserver="$1"
+localport="$2"
+remoteport="$3"
+
+printf "Exit shell to exit tunnel.\n"
+ssh -R ${remoteport}:localhost:${localport} \
+ ${sshserver}
+
(DIR) diff --git a/udp-ssh-reverse-tunnel b/udp-ssh-reverse-tunnel
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+if [ $# -lt 3 ];
+then
+ printf "usage: %s user@sshserver localport remoteport\n" \
+ "$(basename "$0")" >&2
+ exit 1
+fi
+
+sshserver="$1"
+localport="$2"
+remoteport="$3"
+
+randinterport=$(($RANDOM % 9000 + 32000))
+ssh -R ${randinterport}:localhost:${randinterport} \
+ ${sshserver} \
+ "socat -T10 udp4-listen:${remoteport},fork tcp4:localhost:${randinterport}" &
+sshpid=$!
+socat -T10 tcp4-listen:${randinterport},fork udp4:localhost:${localport} &
+socatpid=$!
+
+printf "Press Enter to exit tunnel.\n"
+read -r ${prompt}
+kill -KILL $socatpid
+kill -KILL $sshpid
+