We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi David,
I used your script but doesn't do telnet all host. Please check my error:
oot@NetworkAutomation-1:~# ./pythonloopscript Enter your telnet username: username Password: Telnet to host36 Telnet to host37 Telnet to host38
here is my script:
#!/usr/bin/env python import getpass import sys import telnetlib
user = raw_input("Enter your telnet username: ") password = getpass.getpass()
for n in range (36,39): print ("Telnet to host") + str(n) HOST = "192.168.13." + str(n) tn = telnetlib.Telnet(HOST)
tn.read_until("Username: ") tn.write(user + "\n")
if password: tn.read_until("Password: ") tn.write(password + "\n")
tn.write("conf t\n")
for n in range (2,21): tn.write("no banner exec ^C " + "\n") tn.write("no banner incoming ^C " + "\n") tn.write("no banner login ^C " + "\n") tn.write("no vlan " + str(n) + "\n")
Thanks.
The text was updated successfully, but these errors were encountered:
Change "for n in range (36,39):" to "for n in range (36,40):"
Sorry, something went wrong.
No branches or pull requests
Hi David,
I used your script but doesn't do telnet all host. Please check my error:
oot@NetworkAutomation-1:~# ./pythonloopscript
Enter your telnet username: username
Password:
Telnet to host36
Telnet to host37
Telnet to host38
here is my script:
#!/usr/bin/env python
import getpass
import sys
import telnetlib
user = raw_input("Enter your telnet username: ")
password = getpass.getpass()
for n in range (36,39):
print ("Telnet to host") + str(n)
HOST = "192.168.13." + str(n)
tn = telnetlib.Telnet(HOST)
tn.read_until("Username: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("conf t\n")
for n in range (2,21):
tn.write("no banner exec ^C " + "\n")
tn.write("no banner incoming ^C " + "\n")
tn.write("no banner login ^C " + "\n")
tn.write("no vlan " + str(n) + "\n")
Thanks.
The text was updated successfully, but these errors were encountered: