Skip to content

Instantly share code, notes, and snippets.

@nbardiuk
Created October 19, 2012 12:16
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 nbardiuk/3917950 to your computer and use it in GitHub Desktop.
Save nbardiuk/3917950 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import telnetlib
print "Connecting to the server"
tn = telnetlib.Telnet("192.168.1.1")
print "Connected, waiting to Login"
tn.read_until("Login: ")
tn.write("\r") #login
tn.read_until("Password:" )
tn.write("\r") #password
print "Logined, waiting for promt"
tn.expect([r".*#\s"])
tn.write("set ppp1 mtu 1492\r")
print "command send"
tn.expect([r".*#\s"])
tn.write("exit")
print "exit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment