#!/usr/bin/python

import paramiko
from getpass import getpass
import time
import sys

queryIP = sys.argv[1]
queryUser = sys.argv[2]
queryPass = sys.argv[3]

ip = queryIP
username = queryUser
password = queryPass

remote_conn_pre=paramiko.SSHClient()
remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
remote_conn_pre.connect(ip, port=22, username=username,
                        password=password,
                        look_for_keys=False, allow_agent=False)

remote_conn = remote_conn_pre.invoke_shell()
output = remote_conn.recv(65535)


remote_conn.send("enable\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send('%s\n' % password)
time.sleep(.15)
output = remote_conn.recv(65535)


remote_conn.send("write default\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("y\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("reload\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("y\n")
time.sleep(.10)
output = remote_conn.recv(65535)


exit()


#!/usr/bin/python

import paramiko
import time
import sys

queryIP = sys.argv[1]
queryUser = sys.argv[2]
queryPass = sys.argv[3]

ip = queryIP
username = queryUser
password = queryPass

remote_conn_pre=paramiko.SSHClient()
remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
remote_conn_pre.connect(ip, port=22, username=username,
                        password=password,
                        look_for_keys=False, allow_agent=False)

remote_conn = remote_conn_pre.invoke_shell()
output = remote_conn.recv(65535)


remote_conn.send("enable\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send('%s\n' % password)
time.sleep(.15)
output = remote_conn.recv(65535)


remote_conn.send("write default\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("y\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("reload\n")
time.sleep(.10)
output = remote_conn.recv(65535)


remote_conn.send("y\n")
time.sleep(.10)
output = remote_conn.recv(65535)


exit()


Update cisco_write_default.py