Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import getpass
- import telnetlib
- HOST = "192.168.88.130"
- user = input("Enter your 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"conf t\n")
- tn.write(b"int loo 0\n")
- tn.write(b"ip address 1.1.1.1 255.255.255.255\n")
- tn.write(b"end\n")
- tn.write(b"exit\n"
- print(tn.read_all().decode('ascii'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement