-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |