Python Script:- Telnet to cisco device
import telnetlib
import time
host = '10.10.10.1'
port = '23'
user = 'cisco'
password = 'cisco'
tn = telnetlib.Telnet(host=host, port=port)
tn.read_until(b'Username: ')
tn.write(user.encode() + b'\n')
tn.read_until(b'Password: ')
tn.write(password.encode() + b'\n')
tn.write(b'show ip int brie \n')
tn.write(b'exit \n')
time.sleep(1)
Output
No comments:
Post a Comment