summaryrefslogtreecommitdiff
path: root/pkctl.py
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2023-03-30 13:22:43 -0700
committerCarson Fleming <cflems@cflems.net>2023-03-30 13:22:43 -0700
commit9c78e5db5a1d743007f5a5ff97947a32f049129a (patch)
tree39ddc38b947809844e16f49d936d8ab451638d6a /pkctl.py
parent867c754c81b13d361a71b2081b5934bc5e3adc28 (diff)
downloadpk-9c78e5db5a1d743007f5a5ff97947a32f049129a.tar.gz
Get everything working locally
Diffstat (limited to 'pkctl.py')
-rw-r--r--pkctl.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/pkctl.py b/pkctl.py
index 018c558..fc71b34 100644
--- a/pkctl.py
+++ b/pkctl.py
@@ -124,21 +124,19 @@ def attach_cmd():
print('turned off pty mode due to remote detach')
attached = False
break
- elif pty_mode and data[:6] == b'\xc0\xdenpty':
+ elif pty_mode and b'\xc0\xdenpty' in data:
+ idx = data.index(b'\xc0\xdenpty')
+ pnnl(str(data[:idx], 'utf-8'))
tty.tcsetattr(sys.stdin.fileno(), tty.TCSAFLUSH, stdin_mode)
pty_mode = False
print('turned off pty mode due to npty command')
+ pnnl(str(data[idx+6:], 'utf-8'))
elif not pty_mode and data == b'\xc0\xdepty':
pty_mode = True
stdin_mode = tty.tcgetattr(sys.stdin.fileno())
tty.setraw(sys.stdin.fileno())
else:
- 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'))
+ pnnl(str(data, 'utf-8'))
sel.close()
sock.close()
if pty_mode: