import getpass
import sys
import telnetlib
HOST = input("Enter device IP: ")
user = input("Enter your telnet user: ")
password = getpass.getpass()
tn = telnetlib(HOST)
tn.read("Username: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("enable\n")
tn.write("cisco\n")
tn.write("config t\n")
tn.write("int loopback 0\n")
tn.write("ip address 1.1.1.1 255.255.255.255\n")
tn.write("end\n")
tn.write("exit\n")
print(tn.read())
Anyone help me this error:
Error:
Traceback (most recent call last):
File "D:\NetworkAutomation\AssignIP.py", line 7, in <module>
tn = telnetlib(HOST)
TypeError: 'module' object is not callable
Thanks you so much.