Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telnetlib
- import getpass
- import time
- print ("This is telnet service")
- HOST = input("Enter your target device IP address: ")
- user = input("Enter your device account username: ")
- password = getpass.getpass()
- tn = telnetlib.Telnet(HOST)
- tn.read_until(b"Username: ")
- tn.write(user.encode('ascii') +b"n")
- if password:
- tn.read_until(b"Password: ")
- tn.write(password.encode('ascii')+b"n")
- tn.write(b"terminal length 0n")
- tn.write(b"show interface statusn")
- time.sleep(3)
- output = tn.read_all().decode('ascii')
- print (output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement