首页 > 编程语言 > 详细

Learning Python telnet.lib

时间:2018-07-19 14:44:19      阅读:147      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/env python import getpass import sys import telnetlib HOST = "X.X.X.X" user = raw_input("Enter your telnet username: ") password = getpass.getpass() tn = telnetlib.Telnet(HOST) tn.read_until("username: ") tn.write(user + "\n") if password: tn.read_until("password: ") tn.write(password + "\n") tn.write("terminal length 0\n") tn.write("sh run | sec hostname") tn.write("exit\n") output_*** = tn.read_all()

Learning Python telnet.lib

原文:http://blog.51cto.com/blade20/2147141

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!