程序已经能正常运行,但是只能log270多kb的日志,实际上是有2M多的日志的,不知道怎么修改才能实现全部log出来。请大佬指点
tn = telnetlib.Telnet(ip)
for n in range(1):
time.sleep(1)
tn.write(username.encode('utf-8') + b"\n")
time.sleep(1)
tn.write(password.encode('utf-8') + b"\n")
time.sleep(5)
#tn.write(b"super\n")
#tn.write(enable.encode('utf-8') + b"\n")
print("Successfully connect to", ip)
command = open("disp user", "r")
tn.write(command.read().encode('utf-8'))
# command.seek(0)
time.sleep(60)
log = open(ip + " " + time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())) + ".txt", "a")
log.write(tn.read_very_eager().decode('utf-8'))
tn = telnetlib.Telnet(ip)
for n in range(1):
time.sleep(1)
tn.write(username.encode('utf-8') + b"\n")
time.sleep(1)
tn.write(password.encode('utf-8') + b"\n")
time.sleep(5)
#tn.write(b"super\n")
#tn.write(enable.encode('utf-8') + b"\n")
print("Successfully connect to", ip)
command = open("disp user", "r")
tn.write(command.read().encode('utf-8'))
# command.seek(0)
time.sleep(60)
log = open(ip + " " + time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())) + ".txt", "a")
log.write(tn.read_very_eager().decode('utf-8'))