SHARE
TWEET

Untitled

a guest Dec 31st, 2018 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. from netmiko import ConnectHandler
  3. import sys
  4. import time
  5. import getpass
  6.  
  7. platform = 'cisco_ios'
  8. username = raw_input("Username?:")
  9. password = getpass.getpass(prompt="Password?:")
  10. port = 4000
  11. data = open("hosts.txt")
  12. for line in data:
  13.     try:
  14.         device = ConnectHandler(device_type=platform, ip=line.strip(), username=username, password=password, port=port, secret=password)
  15.         device.enable()
  16.         output = device.send_command_timing('wr mem')
  17.         if 'Version' in output:
  18.             output = device.send_command_timing("\r\n")
  19.         print line
  20.         print output
  21.         f = open("wrmem.txt", 'a')
  22.         f.write(str(line + output + "\n"))
  23.     except:
  24.             continue # Basically, ignore the error
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top