How do I use Python libs such as Paramiko for chain connections with Telnet and SSH

拜拜、爱过 提交于 2019-12-05 08:48:32

You cannot use "channel" class with Telnet class. Telnet class needs to connect to a host:port. So you need to start listening on a local temporary port and forward that to "channel" class. There's a ready-made forward_tunnel function in Paramiko forward.py demo exactly for this purpose:

forward_tunnel(local_unique_port, telnet_host, 23, t0)
telnet = Telnet("localhost", local_unique_port)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!