如下所示:
# -*-coding:utf-8 -*-
def do_telnet(Host, username, password, finish, commands):
import telnetlib
'''''Telnet远程登录:Windows客户端连接Linux服务器'''
# 连接Telnet服务器
tn = telnetlib.Telnet(Host, port=23, timeout=10)
tn.set_debuglevel(2)
# 输入登录用户名
tn.read_until(b'login:')
tn.write(username)
1