summaryrefslogtreecommitdiff
path: root/ssh_hack
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2021-10-30 00:27:43 +0000
committerepoch <epoch@hack.thebackupbox.net>2021-10-30 00:27:43 +0000
commit3c5cd5e68278f82cc071623419e1a205c6fee38b (patch)
tree72d8dc4493e399d7ea6cc094826e527ef9e4c564 /ssh_hack
parent62817acef7618bd5d6e77ffabb39aabe33f5a37c (diff)
parentc38649558142ee7a02c176f373120f417633b022 (diff)
downloaduritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.tar.gz
uritools-3c5cd5e68278f82cc071623419e1a205c6fee38b.zip
Merge branch 'master' of ssh://git.thebackupbox.net/uritools
Diffstat (limited to 'ssh_hack')
-rwxr-xr-xssh_hack26
1 files changed, 26 insertions, 0 deletions
diff --git a/ssh_hack b/ssh_hack
new file mode 100755
index 0000000..e882cd2
--- /dev/null
+++ b/ssh_hack
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+### we need to export each of the query string variables
+### then send them over ssh
+q="$(printf "%s\n" "$1" | uricut -q)"
+p="$(printf "%s\n" "$1" | uricut -p)"
+d="$(printf "%s\n" "$1" | uricut -d)"
+P="$(printf "%s\n" "$1" | uricut -P)"
+u="$(printf "%s\n" "$1" | uricut -u)"
+
+eval "$(printf '%s\n' "$q" | tr '&' ' ' | grep '[^ ]*=' | sed 's/^/export /g')"
+if [ "$p" ];then
+ p="$(uriunescape "$p")"
+fi
+if [ "$P" ]; then
+ HACK_PORT="-p $P"
+fi
+if [ "$u" ];then
+ HACK_USER="$u@"
+fi
+
+tmpfile=$(mktemp);
+printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g' > "$tmpfile"
+
+ssh -F "$tmpfile" -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
+#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
+#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}