From bcd2bc511bfa71c84b3fcb7407219fb34ef9c573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81sar=20Sua=CC=81rez?= Date: Mon, 21 Jan 2019 18:34:13 +0100 Subject: [PATCH] Add an option to use an already connected Paramiko instance --- wssh/server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wssh/server.py b/wssh/server.py index 17a4965..c566267 100644 --- a/wssh/server.py +++ b/wssh/server.py @@ -105,6 +105,11 @@ def open(self, hostname, port=22, username=None, password=None, self._websocket.send(json.dumps({'error': e.message or str(e)})) raise + def attach_open_session(self, ssh_client): + self.close() + self._ssh = ssh_client + + def _forward_inbound(self, channel): """ Forward inbound traffic (websockets -> ssh) """ try: