I am trying to access network devices that are accessible only if you ssh from a bastion host that runs SunOS (no proxycommand support or ssh tunneling)
My approach would be to use the generic driver to access the bastion host. and from there to use ' ssh remotedevicename' to connect to the remote device.
In my case the remote device requires only one step authentication which drops me to the # prompt (level 15 access for Cisco devices)
I manage to successfully authenticate but I can not send commands
Here is what I use
conn = SSH2()
conn.debug=5
conn.set_driver('generic')
conn.connect('bastion')
conn.login(account)
print conn.response
conn.send('ssh 1.1.1.1\n')
conn.expect('Password:')
print conn.response
conn.send('password\n')
At this point I think that I should change the driver with
conn.set_driver('nxos')
conn.execute ("show cdp neighbors\n")
but after doing that the script times out with
nxos: Sending 'show cdp neighbors\n\r'
nxos: Expecting a prompt
nxos: Expected pattern: ["'[\\\\r\\\\n][\\\\-\\\\w+\\\\.:/]+(?:\\\\([^\\\\)]+\\\\))?[>#] ?$'"]
Traceback (most recent call last):
The above sequence is fine I was missing "terminal length 0" and the script was stuck with that