instant tunnel for ssh-tunnelier. bugfix in ansicodes
This commit is contained in:
@@ -139,7 +139,7 @@ ${S}=====================${Z}
|
||||
s .save() Save location u .restore() Restore location
|
||||
A .up() Up E .up_line() Up line
|
||||
B .down() Down F .down_line() Down line
|
||||
C .left() Left y;xH .pos() Absolute Position
|
||||
D .right() Right """
|
||||
C .right() Right y;xH .pos() Absolute Position
|
||||
D .left() Left """
|
||||
|
||||
return(c.color_string(unformatted))
|
||||
|
||||
@@ -281,8 +281,8 @@ ${_S}=====================${_Z}
|
||||
s _qPos save Save location u _qPos restore Restore location
|
||||
A _qPos up Up E _qPos lineup Up line
|
||||
B _qPos down Down F _qPos linedown Down line
|
||||
C _qPos left Left y;xH _qPos abs y x Absolute Position
|
||||
D _qPos right Right
|
||||
C _qPos right Right y;xH _qPos abs y x Absolute Position
|
||||
D _qPos left Left
|
||||
"
|
||||
fi
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ if [[ "$OSTYPE" = "darwin"* ]]; then
|
||||
BASE="base64"
|
||||
UNBASE="base64 -D"
|
||||
fi
|
||||
LOCALHOSTSYMBOL="💻"
|
||||
|
||||
function _helpexit() {
|
||||
echo "SSH tunnel manager
|
||||
@@ -93,7 +94,7 @@ function read_config() {
|
||||
printf "%-3d %-7s %s\n" $i "$pid" "$line"
|
||||
ids+=( $id )
|
||||
i=$(( i + 1 ))
|
||||
done < <( grep -v ^# "$CONF" | grep '[a-zA-Z]' )
|
||||
done < <( grep -v ^# "$CONF" | grep '[a-zA-Z]' ) | sed 's,:localhost:,:'$LOCALHOSTSYMBOL':,g'
|
||||
}
|
||||
|
||||
function run_args() {
|
||||
@@ -119,6 +120,21 @@ function ask_to_kill() {
|
||||
[[ "$input2" = "t" ]] && kill -9 $1
|
||||
}
|
||||
|
||||
function instant_entry() {
|
||||
printf "${colMenu}Start a local forward tunnel${colZ}\n"
|
||||
printf "${colMenu}Host name?${colZ}\n"
|
||||
read -e HOST
|
||||
test -z "$HOST" && return
|
||||
printf "${colMenu}Target port at host?${colZ}\n"
|
||||
read -e REMOTE
|
||||
test -z "$REMOTE" && return
|
||||
printf "${colMenu}Local port where tunnel starts?${colZ}\n"
|
||||
read -e -i "$REMOTE" LOCAL
|
||||
test -z "$LOCAL" && return
|
||||
printf "${colRow}-L ${LOCAL}:localhost:${REMOTE} ${HOST}${colZ}\n"
|
||||
run_args "$HOST" "$LOCAL" "$REMOTE"
|
||||
printf "${colMenu}See the connection in 'list ssh'${colZ}\n"
|
||||
}
|
||||
|
||||
[[ -n "$2" ]] && {
|
||||
run_args "$@"
|
||||
@@ -128,8 +144,8 @@ while true; do
|
||||
ids=()
|
||||
i=1
|
||||
printf "\n${colTitle}=============================================\n"
|
||||
printf "${colTitle} List of tunnels:${colZ}\n"
|
||||
printf "${colTitle} (q)uit (e)dit (l)ist ssh [%s]${colZ}\n" $( date +%H:%M )
|
||||
printf "${colTitle} List of tunnels: (${LOCALHOSTSYMBOL}=localhost) [%s]${colZ}\n" $( date +%H:%M )
|
||||
printf "${colTitle} (q)uit (e)dit (l)ist ssh (i)nstant tunnel${colZ}\n"
|
||||
printf "${colTitle}=============================================\n"
|
||||
printf "${colRow}ID PID command\n"
|
||||
read_config
|
||||
@@ -137,6 +153,7 @@ while true; do
|
||||
read -t 600 input
|
||||
|
||||
[[ "$input" = "q" ]] && exit 0
|
||||
[[ "$input" = "i" ]] && instant_entry
|
||||
[[ "$input" = "e" ]] && vim "$CONF"
|
||||
[[ "$input" = "l" ]] && list_all_ssh
|
||||
[[ "$input" = "0" ]] && continue
|
||||
|
||||
Reference in New Issue
Block a user