Learning Python telnet.lib

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Learning Python telnet.lib相关的知识,希望对你有一定的参考价值。

#!/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 + "
")
if password:
    tn.read_until("password: ")
    tn.write(password + "
")
tn.write("terminal length 0
")

tn.write("sh run | sec hostname")
tn.write("exit
")

output_*** = tn.read_all()

以上是关于Learning Python telnet.lib的主要内容,如果未能解决你的问题,请参考以下文章

Python Learning: 02

Python Machine Learning

python learning_curve函数

Learning Python telnet.lib

Python - 7 Steps to Mastering Machine Learning With Python

python learning GUI