Guest User

Untitled

a guest
Jan 25th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from __future__ import print_function
  2. from netmiko import ConnectHandler
  3. import os
  4. import sys
  5. import time
  6. import select
  7. import paramiko
  8. import re
  9.  
  10. fd = open('C:Test.txt','w')
  11. old_stdout = sys.stdout
  12. sys.stdout = fd
  13. platform = 'cisco_ios'
  14. username = 'cisco'
  15. password = 'cisco'
  16. ip_add_file = open('C:IPAddressList.txt','r')
  17.  
  18. for host in ip_add_file:
  19. #host = host.strip()
  20. device = ConnectHandler(device_type=platform, ip=host, username=username, password=password)
  21. output = device.send_command('sh ver | i upt')
  22. print(output)
  23.  
  24. fd.close()
Add Comment
Please, Sign In to add comment