Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from netmiko import ConnectHandler
- import sys
- import time
- import getpass
- platform = 'cisco_ios'
- username = raw_input("Username?:")
- password = getpass.getpass(prompt="Password?:")
- port = 4000
- data = open("hosts.txt")
- for line in data:
- try:
- device = ConnectHandler(device_type=platform, ip=line.strip(), username=username, password=password, port=port, secret=password)
- device.enable()
- output = device.send_command_timing('wr mem')
- if 'Version' in output:
- output = device.send_command_timing("\r\n")
- #print line
- print output
- #print output2
- f = open("wrmem.txt", 'a')
- f.write(str(line + output + "\n"))
- #f.write(str(output))
- except:
- continue # Basically, ignore the error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement