Created
October 19, 2012 12:16
-
-
Save nbardiuk/3917950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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