From d32f5c67a91ede572c88e431b2ad0ce4d6c87dec Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sat, 4 Apr 2020 16:59:03 -0700 Subject: [PATCH] use startswith() instead of find() --- jc/parsers/iptables.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jc/parsers/iptables.py b/jc/parsers/iptables.py index 9a75fd78..7c82791b 100644 --- a/jc/parsers/iptables.py +++ b/jc/parsers/iptables.py @@ -247,7 +247,7 @@ def parse(data, raw=False, quiet=False): for line in cleandata: - if line.find('Chain') == 0: + if line.startswith('Chain'): raw_output.append(chain) chain = {} headers = [] @@ -259,7 +259,7 @@ def parse(data, raw=False, quiet=False): continue - elif line.find('target') == 0 or line.find('pkts') == 1 or line.find('num') == 0: + elif line.startswith('target') or line.find('pkts') == 1 or line.startswith('num'): headers = [] headers = [h for h in ' '.join(line.lower().strip().split()).split() if h] headers.append("options")