Dec-21-2018, 11:35 PM
I think, I'm close finish this up. :))
if password: tn.read_until(b"Password:") tn.write(password.encode("ascii")+b"\n") tn.read_until(b"#") tn.write(b"conf t"+b"\n") time.sleep(1) tn.write(b"hostname test1"+b"\n") tn.write(b"exit"+b"\n") tn.write(b"terminal length 0"+b"\n") tn.write(b"show run"+b"\n") ## time.sleep(5) #Save method readoutput = tn.read_all() tn.write(b"exit"+b"\n") saveoutput = open("device" + HOST, "w") saveoutput.write(str(readoutput)) saveoutput.close tn.close() breakPut a break at the end, and I eliminate the socket error.. But there no data on the file named as device.