Oct-29-2016, 04:45 AM
i was listing all my code sorted by date/time and ran across some of my earliest python code ... very ugly.
this is from 2010 to fetch the NAT config from our firewall. the experience making this work is what led me into python coding.
and no, the password is no good now (that firewall is gone).
this is from 2010 to fetch the NAT config from our firewall. the experience making this work is what led me into python coding.
#!/usr/bin/env python """Get configuration from a Sonicwall firewall""" import pexpect import sys child = pexpect.spawn('ssh -p 12 169.254.0.2') child.expect('User:') child.sendline('admin') child.expect('Password:') child.sendline('rumnnarb') child.expect('> ') child.sendline('show tsr nat-policies') child.expect('> ') print child.before child.sendline('exit') child.expect('closed') if child.isalive(): child.close()
and no, the password is no good now (that firewall is gone).