From b83b626435c55d2aa63e56dd8f22603da59e7626 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sat, 4 Apr 2020 16:57:23 -0700 Subject: [PATCH] use startswith() instead of find() --- jc/parsers/ifconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index 7c4df2ed..60515a76 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -146,7 +146,7 @@ from ifconfigparser import IfconfigParser class info(): - version = '1.5' + version = '1.6' description = 'ifconfig command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -220,7 +220,7 @@ def process(proc_data): # convert OSX-style subnet mask to dotted quad if 'ipv4_mask' in entry: try: - if entry['ipv4_mask'].find('0x') == 0: + if entry['ipv4_mask'].startswith('0x'): new_mask = entry['ipv4_mask'] new_mask = new_mask.lstrip('0x') new_mask = '.'.join(str(int(i, 16)) for i in [new_mask[i:i + 2] for i in range(0, len(new_mask), 2)])