Python方法完成自动连接ssh示例,python方法ssh示例,Python方法完成自动
Python方法完成自动连接ssh示例,python方法ssh示例,Python方法完成自动
Python方法完成自动连接ssh示例
#!/usr/bin/python#-*- coding:utf-8 -*-import sys, time, ostry: import pexpectexcept ImportError: print """ You must install pexpect module """ sys.exit(1)addr_map = { 'v3' :('root@192.168.1.162', 'sina@2009'), 'dev':('test016@192.168.1.136', 'test016'),}try: key = sys.argv[1] host = addr_map[key]#www.iplaypy.comexcept: print """ argv error, use it link jssh v3, v3 must defined in addr_map """ sys.exit(1)server = pexpect.spawn('/usr/bin/ssh %s' % host[0])server.expect('.*ssword:')server.sendline(host[1])server.interact()
编橙之家文章,
相关内容
- 关于Python解析xml dom的简单应用,python解析xmldom,关于P
- 适用于小公司的订餐系统Python脚本,订餐python,#!/usr/b
- python md5有生成与应用示例,pythonmd5,python md5有生
- 解决Python2不支持datetime的json encode问题,python2json,解决
- Python定期查询域名状态并完成记录的小脚本,python域名
- Python完成远程登陆RouterOS执行并返回命令的操作,pyth
- python编写ini文件的方法,,from ConfigP
- python方法筛选特定宽度的图片方法,,记得之前在做图片
- 完成自动生成CMake脚本的python方法,cmakepython,下面一段
- python对比并输出多文件夹内的不同文件,python对比,py
评论关闭