diff options
author | GDR! <gdr@gdr.name> | 2017-04-08 18:21:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-08 18:21:03 +0200 |
commit | c2ce1771b360bdaf449df2e1662647a73bd98efb (patch) | |
tree | 70433325bc91707941464ca95ac0c1c98ee11de5 | |
parent | 0ba5a19f9942b8086474d91561b9b14a87aa042e (diff) | |
parent | 65243979ba7216b32045c5da98c98f2686a97f7a (diff) |
Merge pull request #38 from fabrixxm/patch-1
tokssh: shared secret support,fix no user cmd line
-rwxr-xr-x | scripts/tokssh | 12 |
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 | ||
11 | array=( $@ ) | 12 | array=( $@ ) |
@@ -13,6 +14,13 @@ len=${#array[@]} | |||
13 | userhost=${array[$len-1]} | 14 | userhost=${array[$len-1]} |
14 | args=${array[@]:0:$len-1} | 15 | args=${array[@]:0:$len-1} |
15 | 16 | ||
17 | if [ "${array[$len-2]}" == "-s" ] | ||
18 | then | ||
19 | secret="${array[@]:$len-2:$len-1}" | ||
20 | len=$[len-2] | ||
21 | fi | ||
22 | |||
23 | |||
16 | arruserhost=(${userhost//@/ }) | 24 | arruserhost=(${userhost//@/ }) |
17 | arruserhostlen=${#arruserhost[@]} | 25 | arruserhostlen=${#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 |
25 | else | 33 | else |
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 |
28 | fi | 36 | fi |
29 | 37 | ||