Records the interface of Cisco devices using a Python script.
#!/usr/bin/env pythonimport paramikoimport sysimport time class ciscoswitch (): def __init__ (Self,host,username,password): self.username = username self.host = host self.password = password def login (self): Self.child = paramiko. Sshclient ()                 &NBSp; self.child.set_missing_host_key_policy (Paramiko. Autoaddpolicy ()) self.child.connect (Self.host,username=self.username,password=self.password) self.remote = self.child.invoke_shell () def showcmd (Self,cmd): print "[+] connect to router ..." Self.remote.send ("\ n") self.remote.send (CMD) &nbSp; time.sleep (0.5)         OUTPUT = SELF.REMOTE.RECV ( ) print output if __name__ == ' __main__ ': print "[+] this program is beging done ... " for ip in open ("/opt/other/ip.txt"): switch = ciscoswitch (IP, ' admin ', ' password.123 ') switch.login () Switch.showcmd ("show ip int brief\n")
Python script to view Cisco device interfaces