Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pexpect
- #rootaIP = with open(iplist) as roota:
- # content = roota.readlines()
- rootaIP = "62.24.114.98"
- rootaUN = "cisco"
- rootaPW = "cisco"
- tncon = 'telnet ' + rootaIP
- rts = pexpect.spawn(tncon)
- rtr = rts.expect (["Username: " , "Password: " , ">"], timeout=60)
- if rtr == 0:
- rts.sendline(rootaUN)
- if rtr == 1:
- rts.sendline(rootaPW)
- if rtr == 2:
- print("Logged in to " + rootaIP)
- rts.sendline("exit")
- rts.expect(pexpect.EOF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement