wok-current annotate dropbear/stuff/sshx @ rev 18686
Add tidy-html5, csstidy, rcssmin
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Dec 10 01:58:32 2015 +0200 (2015-12-10) |
parents | c68cd3e0f194 |
children | 1ae2567134a8 |
rev | line source |
---|---|
pascal@10917 | 1 #!/bin/sh |
pascal@10917 | 2 |
pascal@10917 | 3 xdbclient() |
pascal@10917 | 4 { |
pascal@14027 | 5 read host data |
pascal@14027 | 6 svr=${DISPLAY#*:} |
pascal@11597 | 7 n=$((10+($RANDOM % 90))); dpy=localhost:$n |
pascal@14027 | 8 scr=${DISPLAY/${DISPLAY%.*}/$dpy} |
pascal@14027 | 9 r="" |
pascal@11597 | 10 while true; do |
pascal@14027 | 11 a="$1" |
pascal@14027 | 12 r="$r $1"; shift |
pascal@14027 | 13 case "$a" in |
pascal@14027 | 14 -[piIlLRWKBJ]) r="$r $1"; shift;; |
pascal@11597 | 15 -*) ;; |
pascal@11597 | 16 *) break ;; |
pascal@11597 | 17 esac |
pascal@11597 | 18 done |
pascal@15886 | 19 [ -n "$1" ] || set -- "${TERM:-xterm} -ls || ${TERM:-sakura} -l || xterm -ls" |
pascal@14027 | 20 exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \ |
pascal@14027 | 21 "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \ |
pascal@14027 | 22 </dev/null >/dev/null |
pascal@10917 | 23 } |
pascal@10917 | 24 |
pascal@14027 | 25 pppssh() |
pascal@14027 | 26 { |
pascal@18015 | 27 ssh="dbclient -y" |
pascal@18015 | 28 $ssh $1 true || { |
pascal@18015 | 29 [ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " && |
pascal@18015 | 30 read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD |
pascal@18015 | 31 $ssh $1 true || exit 1 |
pascal@18015 | 32 } |
pascal@18042 | 33 extra="$(route -n | awk -vd=$(nslookup ${1#*@} | \ |
pascal@18042 | 34 sed '$!d;s/.*: \([^ ]*\).*/\1/') \ |
pascal@18036 | 35 '$1=="0.0.0.0"{ print d " gw " $2 " dev " $8 }')" |
pascal@18036 | 36 for i in ${4/default/128.0.0.0/1 0.0.0.0/1} ; do |
pascal@15886 | 37 echo "route add -net $i dev \$1" |
pascal@15886 | 38 done > /etc/ppp/ip-up.d/pppssh$$ |
pascal@18042 | 39 [ "$4" ] && echo "route add $extra" >> /etc/ppp/ip-up.d/pppssh$$ |
pascal@15886 | 40 chmod +x /etc/ppp/ip-up.d/pppssh$$ |
pascal@14027 | 41 n=10.$(($$%256)).$(($$/256)) |
pascal@15886 | 42 ppp="/usr/sbin/pppd local noauth nodetach" |
pascal@15886 | 43 $ppp ${2:-$n.1:$n.2} passive pty "$ssh $1 $ppp ${3:-proxyarp} notty" \ |
pascal@15886 | 44 ipparam pppssh$$ |
pascal@18036 | 45 [ "$4" ] && route del $extra |
pascal@15886 | 46 rm -f /etc/ppp/ip-up.d/pppssh$$ |
pascal@14027 | 47 } |
pascal@14027 | 48 |
pascal@18330 | 49 xfbvnc() |
pascal@18330 | 50 { |
pascal@18330 | 51 p=5900 |
pascal@18330 | 52 while netstat -tln | grep -q ":$p " ; do p=$(($p+1)); done |
pascal@18331 | 53 [ -r /dev/input/mice ] || echo "Warning: Cannot read mouse input." 1>&2 |
pascal@18330 | 54 dbclient -f -N -L $p:127.0.0.1:${2:-5900} $1 |
pascal@18330 | 55 fbvnc 127.0.0.1 $p |
pascal@18330 | 56 kill $(netstat -tlnp 2> /dev/null | \ |
pascal@18330 | 57 sed "/:$p /!d;s|.* \\([0-9]*\\)/[^ ]*|\\1|") |
pascal@18330 | 58 } |
pascal@18330 | 59 |
pascal@14027 | 60 case "$(basename $0)" in |
pascal@18330 | 61 *vnc) [ -z "$1" ] && cat <<EOT || xfbvnc "$@" ;; |
pascal@18330 | 62 Usage: $0 '[sshargs] user@remote' [vncport] |
pascal@18332 | 63 $(fbvnc --help 2>&1 | sed '1,/Usage:/d') |
pascal@18330 | 64 EOT |
pascal@15886 | 65 ppp*) [ -z "$1" ] && cat <<EOT || pppssh "$@" ;; |
pascal@15886 | 66 Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs' 'routes' |
pascal@15886 | 67 Example: $0 tux@slitaz.org '' '' '192.168.1.0/24 10.1.2.0/24' |
pascal@15886 | 68 EOT |
pascal@14027 | 69 *) [ -z "$DISPLAY" ] && exec dbclient "$@" |
pascal@14027 | 70 xauth list $DISPLAY | xdbclient "$@" |
pascal@10917 | 71 esac |