Skip to content

Instantly share code, notes, and snippets.

@Katharine
Created April 5, 2012 11:57
Show Gist options
  • Save Katharine/2310349 to your computer and use it in GitHub Desktop.
Save Katharine/2310349 to your computer and use it in GitHub Desktop.
def get_interfaces(fname):
interfaces = []
current = []
with open(fname) as f:
for line in f:
line = line.strip()
if line == '!':
if current:
interfaces.append(current)
current = []
else:
current.append(line)
if current:
interfaces.append(current)
interesting = []
for interface in interfaces:
if 'switchport port-security mac-address sticky' in interface and 'switchport port-security' not in interface:
interesting.append(interface)
return interesting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment