Make ssh data start request transmission more robust
This commit is contained in:
parent
37c185462a
commit
12658c4756
@ -10,6 +10,7 @@ import sys
|
|||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
from base64 import standard_b64decode
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Dict, Iterator, List, NoReturn, Optional, Set, Tuple, Union
|
Any, Dict, Iterator, List, NoReturn, Optional, Set, Tuple, Union
|
||||||
@ -62,7 +63,11 @@ def get_ssh_data(msg: str, shell_integration_dest: str = DEFAULT_SHELL_INTEGRATI
|
|||||||
return f'\036{msg}:'.encode('ascii')
|
return f'\036{msg}:'.encode('ascii')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
hostname, pwfilename, pw = msg.split(':', 2)
|
msg = standard_b64decode(msg).decode('utf-8')
|
||||||
|
md = dict(x.split('=', 1) for x in msg.split(':'))
|
||||||
|
hostname = md['hostname']
|
||||||
|
pw = md['pw']
|
||||||
|
pwfilename = md['pwfile']
|
||||||
except Exception:
|
except Exception:
|
||||||
yield fmt_prefix('!invalid ssh data request message')
|
yield fmt_prefix('!invalid ssh data request message')
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -8,7 +8,7 @@ cleanup_on_bootstrap_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
die() { printf "\033[31m%s\033[m\n" "$*" > /dev/stderr; cleanup_on_bootstrap_exit; exit 1; }
|
die() { printf "\033[31m%s\033[m\n" "$*" > /dev/stderr; cleanup_on_bootstrap_exit; exit 1; }
|
||||||
dsc_to_kitty() { printf "\033P@kitty-$1|%s\033\\" "$(printf "%s" "$2" | base64)" > /dev/tty; }
|
dsc_to_kitty() { printf "\033P@kitty-$1|%s\033\\" "$(printf "%s" "$2" | base64 | tr -d \\n)" > /dev/tty; }
|
||||||
debug() { dsc_to_kitty "print" "debug $1"; }
|
debug() { dsc_to_kitty "print" "debug $1"; }
|
||||||
echo_via_kitty() { dsc_to_kitty "echo" "$1"; }
|
echo_via_kitty() { dsc_to_kitty "echo" "$1"; }
|
||||||
saved_tty_settings=$(command stty -g)
|
saved_tty_settings=$(command stty -g)
|
||||||
@ -34,7 +34,7 @@ password_filename="PASSWORD_FILENAME"
|
|||||||
data_complete="n"
|
data_complete="n"
|
||||||
leading_data=""
|
leading_data=""
|
||||||
|
|
||||||
printf "\033P@kitty-ssh|%s:%s:%s\033\\" "$hostname" "$password_filename" "$data_password"
|
dsc_to_kitty "ssh" "hostname=$hostname:pwfile=$password_filename:pw=$data_password"
|
||||||
size=""
|
size=""
|
||||||
|
|
||||||
untar() {
|
untar() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user