Skip to content

Instantly share code, notes, and snippets.

Created February 13, 2018 17:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b15d5f92a7d18bb07a6b3dd3e1a368af to your computer and use it in GitHub Desktop.
Save anonymous/b15d5f92a7d18bb07a6b3dd3e1a368af to your computer and use it in GitHub Desktop.
PYTHON TELNET SCRIPT
import getpass
import sys
import telnetlib
HOST = "YOUR ROUTER IP ADDRESS"
user = raw_input("Enter your telnet username: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("Username: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("exit\n")
print tn.read_all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment