From 9a9c7ff09bbcf3ff5a7d8913ff00a25a2b7e0dc4 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 12 Jan 2023 06:43:56 -0800 Subject: Add some better logging/data stream tolerance to pkctl --- pkctl.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkctl.py b/pkctl.py index caf8a20..79e325d 100644 --- a/pkctl.py +++ b/pkctl.py @@ -128,7 +128,12 @@ def attach_cmd(): stdin_mode = tty.tcgetattr(sys.stdin.fileno()) tty.setraw(sys.stdin.fileno()) else: - pnnl(str(data, 'utf-8')) + if data[:6] == b'\xc0\xdenpty': + pnnl(str(data[6:], 'utf-8')) + elif data[:2] == b'\xc0\xde': + print('Received bogus code from server', data) + else: + pnnl(str(data, 'utf-8')) sel.close() sock.close() if pty_mode: -- cgit v1.2.3