wap网站e4a做app,中国网络运营商排名,2017优惠券网站怎么做,关键词seo服务调试IDE#xff1a;PyCharm
Python库#xff1a;Paramiko
首先安装Paramiko包到PyCharm#xff0c;具体步骤为#xff1a;在打开的PyCharm工具中#xff0c;选择顶部菜单栏中“File”下的“Settings”#xff0c;在设置对话框中#xff0c;选择“Project”下的“Proje…调试IDEPyCharm
Python库Paramiko
首先安装Paramiko包到PyCharm具体步骤为在打开的PyCharm工具中选择顶部菜单栏中“File”下的“Settings”在设置对话框中选择“Project”下的“Project Interpreter”。 在项目解释器列表中我们没有看到Paramiko。然后我们单击上方的“”按钮来添加新的Python包在弹出的对话框中搜索“Paramiko”单击“Install Package”按钮等待安装完成。 基于此相关的准备环境已经完成进行相关脚本的编写具体过程在这里就不赘述了直接展示相关脚本如下所示
import paramikodef ssh_login(hostname, username, password):try:client paramiko.SSHClient()client.set_missing_host_key_policy(paramiko.AutoAddPolicy())client.connect(hostname, usernameusername, passwordpassword)# 登录ssh后然后显示所以网卡信息stdin, stdout, stderr client.exec_command(ip addr show)print(stdout.read().decode())client.close()except Exception as e:print(SSH登录失败:, e)if __name__ __main__:hostname xx.xx.xx.xxusername xxxxpassword xxxxssh_login(hostname, username, password)
脚本运行结果如下所示