From ea3bfeee9e97fed07ce41281d254b178e2f8f470 Mon Sep 17 00:00:00 2001 From: Federico Luzzi Date: Mon, 4 Dec 2023 11:11:58 -0300 Subject: [PATCH] fixes for jumphost --- connpy/_version.py | 2 +- connpy/core.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/connpy/_version.py b/connpy/_version.py index f265519..362b28c 100644 --- a/connpy/_version.py +++ b/connpy/_version.py @@ -1,2 +1,2 @@ -__version__ = "3.7.0b1" +__version__ = "3.7.0b2" diff --git a/connpy/core.py b/connpy/core.py index 9f67b2a..924fabd 100755 --- a/connpy/core.py +++ b/connpy/core.py @@ -127,11 +127,11 @@ class node: if self.jumphost["protocol"] == "ssh": jumphost_cmd = self.jumphost["protocol"] + " -W %h:%p" - if self.port != '': + if self.jumphost["port"] != '': jumphost_cmd = jumphost_cmd + " -p " + self.jumphost["port"] - if self.options != '': + if self.jumphost["options"] != '': jumphost_cmd = jumphost_cmd + " " + self.jumphost["options"] - if self.user == '': + if self.jumphost["user"] == '': jumphost_cmd = jumphost_cmd + " {}".format(self.jumphost["host"]) else: jumphost_cmd = jumphost_cmd + " {}".format("@".join([self.jumphost["user"],self.jumphost["host"]])) @@ -482,7 +482,7 @@ class node: cmd = cmd + " {}".format(self.host) else: cmd = cmd + " {}".format("@".join([self.user,self.host])) - expects = ['yes/no', 'refused', 'supported', 'Invalid|[u|U]sage:', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:|[u|U]sername:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "bad permissions"] + expects = ['yes/no', 'refused', 'supported', 'Invalid|[u|U]sage: (ssh|sftp)', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:|[u|U]sername:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "bad permissions"] elif self.protocol == "telnet": cmd = "telnet " + self.host if self.port != '': @@ -495,7 +495,7 @@ class node: passwords = self._passtx(self.password) else: passwords = [] - expects = ['[u|U]sername:', 'refused', 'supported', 'cipher', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "bad permissions"] + expects = ['[u|U]sername:', 'refused', 'supported', 'invalid option', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "bad permissions"] else: raise ValueError("Invalid protocol: " + self.protocol) attempts = 1