Last active
August 29, 2015 14:16
-
-
Save cjxgm/0b34d7aeb6a3482ab3ec to your computer and use it in GitHub Desktop.
Widow Queen (Gua Fu Wang) automated, ssh tunnel with empty, auto login by password, on OpenWRT
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 characters
#!/bin/bash | |
DIR=/tmp | |
PREFIX=$DIR/widow | |
PIDFILE=$PREFIX.pid | |
IN=$PREFIX.in | |
OUT=$PREFIX.out | |
echo -e '\e[1;33mkilling ex widow queen...\e[0m' | |
empty -k $(< $PIDFILE) | |
echo -e '\e[1;33mconnecting to server...\e[0m' | |
empty -f -i $IN -o $OUT -p $PIDFILE \ | |
ssh -N -D 0.0.0.0:7070 <user>@<host> -v | |
empty -w -v -t 60 -i $OUT -o $IN "password:" "" # "(yes/no):" "yes\n" | |
echo -e '\n\e[1;33mlogging in...\e[0m' | |
empty -s -o $IN "<password>\n" | |
empty -w -v -i $OUT -o $IN "interactive session" "" | |
echo -e '\e[1;32mdone\e[0m' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment