Advertisement
Guest User

Untitled

a guest
Mar 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import pexpect
  2.  
  3. #rootaIP = with open(iplist) as roota:
  4. # content = roota.readlines()
  5.  
  6. rootaIP = "62.24.114.98"
  7. rootaUN = "cisco"
  8. rootaPW = "cisco"
  9. tncon = 'telnet ' + rootaIP
  10.  
  11. rts = pexpect.spawn(tncon)
  12. rtr = rts.expect (["Username: " , "Password: " , ">"], timeout=60)
  13. if rtr == 0:
  14. rts.sendline(rootaUN)
  15. if rtr == 1:
  16. rts.sendline(rootaPW)
  17. if rtr == 2:
  18. print("Logged in to " + rootaIP)
  19. rts.sendline("exit")
  20. rts.expect(pexpect.EOF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement