Last active
June 4, 2018 11:33
-
-
Save tribut/5285883 to your computer and use it in GitHub Desktop.
Revisions
-
tribut revised this gist
Apr 10, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ if [ -z "$REMOTEIP" ]; then exit 1 fi # does the remote have a hostname listed in .ssh/config REMOTEHOST="`grep -E -C1 \"^Host ([a-zA-Z0-9 ]+ )?$REMOTE( [a-zA-Z0-9 ]+)?$\" ~/.ssh/config | tail -n1 | sed -r 's/\W*Hostname\W+//'`" if [ -z "$REMOTEHOST" ]; then REMOTEHOST="$REMOTE"; fi # try to resolve hostname REMOTEIP="`dig +short $REMOTEHOST`" -
tribut revised this gist
Apr 10, 2013 . 1 changed file with 18 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,41 @@ #!/bin/sh # ########################################################## # # wrapper for mosh to work with ssh's proxycommand directive # # this only makes sense if the machine is directly reachable # # from the internet using udp. # # ########################################################## # THISSCRIPT="`basename \"$0\"`" REMOTE="$1" REMOTEIP="$2" debug() { echo "[$THISSCRIPT] $@" >&2 } usage() { debug "use me like this: $THISSCRIPT host [ip]" } # some default values if [ -z "$REMOTEIP" ]; then if [ -z "$REMOTE" ]; then usage exit 1 fi # does the remote have a hostname listed in .ssh/config REMOTEHOST="`grep -E -C1 '^Host ([a-zA-Z0-9 ]+ )?porcus( [a-zA-Z0-9 ]+)?$' ~/.ssh/config | tail -n1 | sed -r 's/\W*Hostname\W+//'`" if [ -z "$REMOTEHOST" ]; then REMOTEHOST="$REMOTE"; fi # try to resolve hostname REMOTEIP="`dig +short $REMOTEHOST`" if [ -z "$REMOTEIP" ]; then debug "could not resolve hostname $REMOTE" exit 1 fi fi debug "starting mosh-server on remote server $REMOTE" MOSHDATA="`ssh -t \"$REMOTE\" mosh-server new | grep '^MOSH' | tr -d \"\r\n\"`" if [ -z "$MOSHDATA" ]; then debug "mosh-server could not be started" exit 1 @@ -42,5 +49,5 @@ if [ -z "$PORT" -o -z "$MKEY" ]; then exit 1 fi debug "starting local mosh-client to $REMOTEIP" MOSH_KEY="$MKEY" exec mosh-client "$REMOTEIP" "$PORT" -
tribut revised this gist
Apr 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ debug() { if [ -z "$REMOTEIP" ]; then if [ -z "$REMOTE" ]; then ## bail out: debug "please call me like this: $0 host [ip]" exit 1 ## or: #REMOTE="PUT_DEFAULT_HOST_HERE" -
tribut revised this gist
Apr 1, 2013 . 1 changed file with 13 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,10 +10,21 @@ debug() { # some default values if [ -z "$REMOTEIP" ]; then if [ -z "$REMOTE" ]; then ## bail out: debug "please call me like this: ./$THISSCRIPT host [ip]" exit 1 ## or: #REMOTE="PUT_DEFAULT_HOST_HERE" fi ## try to resolve hostname: REMOTEIP="`dig +short $REMOTE`" if [ -z "$REMOTEIP" ]; then debug "could not resolve hostname" exit 1 fi ## or: #REMOTEIP="PUT_DEFAULT_IP_HERE" fi debug "starting mosh-server on remote server $REMOTE" -
tribut created this gist
Apr 1, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/bin/sh THISSCRIPT="`basename \"$0\"`" REMOTE="$1" REMOTEIP="$2" debug() { echo "[$THISSCRIPT] $@" >&2 } # some default values if [ -z "$REMOTEIP" ]; then REMOTEIP="PUT_DEFAULT_IP_HERE" if [ -z "$REMOTE" ]; then REMOTE="PUT_DEFAULT_HOST_HERE" fi fi debug "starting mosh-server on remote server $REMOTE" MOSHDATA="`ssh -t \"$REMOTE\" mosh-server new -s | grep '^MOSH' | tr -d \"\r\n\"`" if [ -z "$MOSHDATA" ]; then debug "mosh-server could not be started" exit 1 fi PORT="`echo -n \"$MOSHDATA\" | cut -s -d' ' -f3`" MKEY="`echo -n \"$MOSHDATA\" | cut -s -d' ' -f4`" if [ -z "$PORT" -o -z "$MKEY" ]; then debug "got no parseable answer" exit 1 fi debug "starting local mosh-client" MOSH_KEY="$MKEY" exec mosh-client "$REMOTEIP" "$PORT"