Python 脚本 - 连接到 SSH 并运行命令 [英] Python script - connect to SSH and run command

查看:46
本文介绍了Python 脚本 - 连接到 SSH 并运行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经知道有适用于 Python 的 ssh 模块,这不是我要找的.我想要的是一个 python 脚本来执行以下操作:

I already know there are ssh modules for Python, that's not for what I'm looking for. What I want to have is an python script to do the following:

  1. > 连接到 [ 用户输入 ] SSH 主机
  2. > 使用凭据 [ 由用户提供 ] 进行连接
  3. > 在 SSH 主机上运行命令 [ telnet to [host - input by user ]
  4. >在telnet会话中选择菜单项

提前致谢,

最好的问候,

推荐答案

使用 paramiko,见 http://jessenoller.com/2009/02/05/ssh-Programming-with-paramiko-completely-different/ 使用它的完整示例.

Use paramiko, see http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/ for a through example of using it.

这篇关于Python 脚本 - 连接到 SSH 并运行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆