Hi guys how are you
please why When I run this code it does not work but when I change the ( tn.write(b"config t \n")
tn.write(b"router ospf 10 \n") to the show command it works fine ??
****************************************************************************************************************
import sys
import telnetlib
import getpass
host=["192.168.1.164","192.168.1.169"]
devno=len(host)
user='ali'
Password='cisco'
for i in range(devno):
print('*'*50 + ' Connected to device : '+str(host[i]) +'*'*50)
tn=telnetlib.Telnet(host[i])
tn.read_until(b'Username: ')
tn.write(user.encode('ascii')+ b'\n')
tn.read_until(b'Password')
tn.write(Password.encode('ascii')+b'\n')
tn.write(b"config t \n") if I change to tn.write(b"show ip route \n") it works fine
tn.write(b"router ospf 10 \n") if I change to tn.write(b"show ip inter bri \n") it works fine
tn.write(b' exit\n')
print(tn.read_all().decode('ascii'))
aliabd 0 Newbie Poster
aliabd 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.