From 967a260e4fb84659424e9b81cc7f6318380ae02d Mon Sep 17 00:00:00 2001 From: GDR! Date: Sat, 13 Dec 2014 18:49:14 +0100 Subject: [PATCH] Added tokssh wrapper script --- scripts/tokssh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/tokssh diff --git a/scripts/tokssh b/scripts/tokssh new file mode 100755 index 0000000..ef44e3c --- /dev/null +++ b/scripts/tokssh @@ -0,0 +1,31 @@ +#!/bin/bash + +# +# A simple wrapper to use like SSH +# Usage: +# tokssh user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 +# tokssh 5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 +# tokssh -p 2222 -o ForwardAgent=yes user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 + +array=( $@ ) +len=${#array[@]} +userhost=${array[$len-1]} +args=${array[@]:0:$len-1} + +arruserhost=(${userhost//@/ }) +arruserhostlen=${#arruserhost[@]} + +if [ $arruserhostlen -gt 1 ] +then +# last argument is user@toxid + user=${arruserhost[0]} + toxid=${arruserhost[1]} + ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args $user@localhost +else +# last argument is just toxid + ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args localhost +fi + + + +#ssh -o ProxyCommand='tuntox -i %h -P 127.0.0.1:22' $args %r@localhost