summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/tokssh31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/tokssh b/scripts/tokssh
new file mode 100755
index 0000000..ef44e3c
--- /dev/null
+++ b/scripts/tokssh
@@ -0,0 +1,31 @@
1#!/bin/bash
2
3#
4# A simple wrapper to use like SSH
5# Usage:
6# tokssh user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
7# tokssh 5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
8# tokssh -p 2222 -o ForwardAgent=yes user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
9
10array=( $@ )
11len=${#array[@]}
12userhost=${array[$len-1]}
13args=${array[@]:0:$len-1}
14
15arruserhost=(${userhost//@/ })
16arruserhostlen=${#arruserhost[@]}
17
18if [ $arruserhostlen -gt 1 ]
19then
20# last argument is user@toxid
21 user=${arruserhost[0]}
22 toxid=${arruserhost[1]}
23 ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args $user@localhost
24else
25# last argument is just toxid
26 ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args localhost
27fi
28
29
30
31#ssh -o ProxyCommand='tuntox -i %h -P 127.0.0.1:22' $args %r@localhost