wok-next view dropbear/stuff/sshx @ rev 15622
network-manager: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Dec 08 13:38:47 2013 +0000 (2013-12-08) |
parents | bdff68e2cdc7 |
children | 31599711e814 |
line source
1 #!/bin/sh
3 xdbclient()
4 {
5 read host data
6 svr=${DISPLAY#*:}
7 n=$((10+($RANDOM % 90))); dpy=localhost:$n
8 scr=${DISPLAY/${DISPLAY%.*}/$dpy}
9 r=""
10 while true; do
11 a="$1"
12 r="$r $1"; shift
13 case "$a" in
14 -[piIlLRWKBJ]) r="$r $1"; shift;;
15 -*) ;;
16 *) break ;;
17 esac
18 done
19 [ -n "$1" ] || set -- "${TERM:-false} || xterm -ls"
20 exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \
21 "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \
22 </dev/null >/dev/null
23 }
25 pppssh()
26 {
27 [ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " &&
28 read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD
29 dbclient -y $1 true || exit 1
30 ff=/tmp/pppssh$$
31 n=10.$(($$%256)).$(($$/256))
32 ppp="/usr/sbin/pppd local lock notty"
33 mkfifo $ff
34 dbclient -y $1 "$ppp ${3:-proxyarp}" <$ff | $ppp ${2:-$n.1:$n.2} >$ff
35 rm -f $ff
36 }
38 case "$(basename $0)" in
39 ppp*) [ -z "$1" ] &&
40 echo "Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs'" ||
41 pppssh "$@" ;;
42 *) [ -z "$DISPLAY" ] && exec dbclient "$@"
43 xauth list $DISPLAY | xdbclient "$@"
44 esac