Created
April 5, 2012 11:57
-
-
Save Katharine/2310349 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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