summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2017-04-08 18:21:03 +0200
committerGitHub <noreply@github.com>2017-04-08 18:21:03 +0200
commitc2ce1771b360bdaf449df2e1662647a73bd98efb (patch)
tree70433325bc91707941464ca95ac0c1c98ee11de5
parent0ba5a19f9942b8086474d91561b9b14a87aa042e (diff)
parent65243979ba7216b32045c5da98c98f2686a97f7a (diff)
Merge pull request #38 from fabrixxm/patch-1
tokssh: shared secret support,fix no user cmd line
-rwxr-xr-xscripts/tokssh12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/tokssh b/scripts/tokssh
index 9d219bb..0017221 100755
--- a/scripts/tokssh
+++ b/scripts/tokssh
@@ -6,6 +6,7 @@
6# tokssh user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 6# tokssh user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
7# tokssh 5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 7# tokssh 5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
8# tokssh -p 2222 -o ForwardAgent=yes user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 8# tokssh -p 2222 -o ForwardAgent=yes user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054
9# tokssh user@5A40C3443ABD6E1DDEE682E83F84A4D556C24C22D2230DCC141A4723C123473C171A4D9C4054 -s TuNToXSeCreT
9# 10#
10 11
11array=( $@ ) 12array=( $@ )
@@ -13,6 +14,13 @@ len=${#array[@]}
13userhost=${array[$len-1]} 14userhost=${array[$len-1]}
14args=${array[@]:0:$len-1} 15args=${array[@]:0:$len-1}
15 16
17if [ "${array[$len-2]}" == "-s" ]
18then
19 secret="${array[@]:$len-2:$len-1}"
20 len=$[len-2]
21fi
22
23
16arruserhost=(${userhost//@/ }) 24arruserhost=(${userhost//@/ })
17arruserhostlen=${#arruserhost[@]} 25arruserhostlen=${#arruserhost[@]}
18 26
@@ -21,9 +29,9 @@ then
21# last argument is user@toxid 29# last argument is user@toxid
22 user=${arruserhost[0]} 30 user=${arruserhost[0]}
23 toxid=${arruserhost[1]} 31 toxid=${arruserhost[1]}
24 ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args $user@localhost 32 ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p $secret" $args $user@localhost
25else 33else
26# last argument is just toxid 34# last argument is just toxid
27 ssh -o ProxyCommand="tuntox -i $toxid -P 127.0.0.1:%p" $args localhost 35 ssh -o ProxyCommand="tuntox -i $userhost -P 127.0.0.1:%p $secret" $args localhost
28fi 36fi
29 37