wok-6.x rev 19830
dropbear/xfbvnc: gateway support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 10 12:21:33 2017 +0100 (2017-03-10) |
parents | ce7157786dac |
children | 8ee47858f44a |
files | dropbear/stuff/sshx |
line diff
1.1 --- a/dropbear/stuff/sshx Thu Mar 09 18:47:59 2017 +0100 1.2 +++ b/dropbear/stuff/sshx Fri Mar 10 12:21:33 2017 +0100 1.3 @@ -42,8 +42,12 @@ 1.4 n="${2:-$n.1:$n.2} passive" 1.5 ppp="/usr/sbin/pppd local noauth nodetach" 1.6 arg="$n pty '$ssh $1 $ppp ${3:-proxyarp} notty'" 1.7 - [ -n "$5" ] && arg="noipdefault pty 'nc -u ${1#*@} $5'" && $ssh -f $1 \ 1.8 - "$ppp $n ${3:-proxyarp} pty 'nc -ulp $5' >/dev/null" 1.9 + pppsvr="$ppp $n ${3:-proxyarp} notty >/dev/null" 1.10 + sshcmd="nc -ulp $5 -e $pppsvr" 1.11 + udpcmd="nc -u ${1#*@} $5" 1.12 + [ "$6" == "test" ] && sshcmd="nc -ulp $5 -e nc localhost 22" && 1.13 + udpcmd="dbclient -J \"nc -u ${1#*@} $5\" ${1%@*}@localhost $pppsvr" 1.14 + [ -n "$5" ] && arg="noipdefault pty '$udpcmd'" && $ssh -f $1 "$sshcmd" 1.15 eval $ppp $arg ipparam pppssh$$ 1.16 [ "$4" ] && route del $extra 1.17 rm -f /etc/ppp/ip-up.d/pppssh$$ 2> /dev/null 1.18 @@ -54,7 +58,8 @@ 1.19 p=5900 1.20 while netstat -tln | grep -q ":$p " ; do p=$(($p+1)); done 1.21 [ -r /dev/input/mice ] || echo "Warning: Cannot read mouse input." 1>&2 1.22 - dbclient -f -N -L $p:127.0.0.1:${2:-5900} $1 1.23 + svr=${1#*/}; [ "$svr" == "$1" ] && svr=127.0.0.1 1.24 + dbclient -f -N -L $p:$svr:${2:-5900} ${1%/*} 1.25 fbvnc 127.0.0.1 $p 1.26 kill $(netstat -tlnp 2> /dev/null | \ 1.27 sed "/:$p /!d;s|.* \\([0-9]*\\)/[^ ]*|\\1|") 1.28 @@ -62,7 +67,7 @@ 1.29 1.30 case "$(basename $0)" in 1.31 *vnc) [ -z "$1" ] && cat <<EOT || xfbvnc "$@" ;; 1.32 -Usage: $0 '[sshargs] user@remote' [vncport] 1.33 +Usage: $0 '[sshargs] user@remote[/lanip]' [vncport] 1.34 $(fbvnc --help 2>&1 | sed '1,/Usage:/d') 1.35 EOT 1.36 ppp*) [ -z "$1" ] && cat <<EOT || pppssh "$@" ;;