python:将telnet应用程序转换为ssh

问题描述:

我写了一个 python telnet 客户端,通过 telnet 与服务器通信.但是,很多人告诉我它不安全.如何将其转换为 ssh?我是否需要完全重写我的程序?

I write a python telnet client to communicate with a server through telnet. However, many people tell me that it's no secure. How can I convert it to ssh? Should I need to totally rewrite my program?

只需通过 SSH 创建一个 TCP 隧道并通过那里中继所有数据,无需重新发明轮子.您可以在 TCP 隧道下的 SSH 文档中找到示例(例如 man ssh).

Just create a TCP tunnel via SSH and relay all the data through there, no need to reinvent the wheel. You can find examples in SSH docs under TCP tunneling (man ssh for instance).

但如果您真的想重写它,请查看 paramiko 项目.

But if you really want to rewrite it, then check out paramiko project.