Created
April 9, 2020 19:03
-
-
Save marcelohd/5f20be0f89b0244b936edca92e0eb0a4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import getpass | |
| import sys | |
| import telnetlib | |
| host = raw_input("Enter your HOST") | |
| user = raw_input("Entre com o seu usuario: ") | |
| passwd = getpass.getpass() | |
| tel_net = telnetlib.Telnet(host) | |
| tel_net.read_until("Username: ") | |
| tel_net.write(user + "\n") | |
| if passwd: | |
| tel_net.read_until("Password: ") | |
| tel_net.write(passwd + "\n") | |
| tel_net.write("enable\n") | |
| tel_net.write("configure terminal\n") | |
| for n in range(0, 4): | |
| tel_net.write("interface range et" + n + "/" + n + "-" + 3) | |
| tel_net.write("du fu\n") | |
| tel_net.write("end\n") | |
| tel_net.write("exit\n") | |
| print tel_net.read_all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment