I'm trying to get a script working to log into Cisco devices using Python and Exscript.
Being completely new at this I'm stuck with an error I'm getting around the IP address portion.
AttributeError: 'str' object has no attribute 'connect'
I get what this means but im not sure how to take an input and make it an object.
Switch_IP = raw_input('Core Switch IP :')
print
print "Login Method"
print "============"
print "1.Telnet"
print "2.SSHv2"
print
Connection_Type = raw_input('Connection Type :')
Device_IP = raw_input('IP Address :')
conn = 'null'
if Connection_Type == '1':
conn = 'Telnet()'
elif Connection_Type == '2':
conn = 'SSH2()'
account = read_login()
conn.connect(Switch_IP)
conn.login(account)
conn.execute('term len 0')
conn.execute('term width 0')
conn.execute("show ip arp | i " + Device_IP)
f = open("ARP-Output-tmp.txt","w")
f.write(conn.response)
f.close()
It was working at one point but I'm not sure what I've done to stop it working.
Thanks