Skip to content

Instantly share code, notes, and snippets.

@wattnotions
Created May 25, 2014 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wattnotions/f52f0f1653b980b1935c to your computer and use it in GitHub Desktop.
Save wattnotions/f52f0f1653b980b1935c to your computer and use it in GitHub Desktop.
# Program written 17 April 2014
# Enter default username and password
# waits for commands, then prints results
import telnetlib
tn = telnetlib.Telnet("192.168.1.100", "23")
print tn.read_until("Username>") # wait till prompted for username
tn.write("alien\n")
print tn.read_until("Password>") # wait till prompted for password
tn.write("password\n")
print tn.read_until("Alien>")
while True:
tn.write(raw_input()+ "\n") # enter commands
print (tn.read_until('Alien>'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment