下载后主要有3个文件:
Systems.py 定义了一些不同设备的操作系统及其常见命令。
Connectivity.py 是主要实现功能的代码,其实主要就是使用了python的pexpect模块。
Driver.py是一个示例文件。
[root@safe tratto-master]# cat driver.py
#!/usr/bin/env python import Connectivity import Systems #telnet to a cisco switch m = Systems.OperatingSystems['IOS'] s = Connectivity.Session("192.168.1.1",23,"telnet",m) s.login("yourusername", "yourpassword") # if your need to issue an "enable" command s.escalateprivileges('yourenablepassword') s.sendcommand("show clock") s.sendcommand("show run") s.logout()
Copyright © 2019- yrrf.cn 版权所有 赣ICP备2024042794号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务