From 6aea066cf024f92adf4b94eebc7d51430c22332c Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 23 Apr 2021 16:14:11 -0700 Subject: [PATCH] make normalized list appear only when data exists. set magic commands --- jc/parsers/ufw_appinfo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jc/parsers/ufw_appinfo.py b/jc/parsers/ufw_appinfo.py index ae4d83c5..57396f2c 100644 --- a/jc/parsers/ufw_appinfo.py +++ b/jc/parsers/ufw_appinfo.py @@ -127,7 +127,7 @@ class info(): author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' compatible = ['linux'] - magic_commands = ['ufw-appinfo'] + magic_commands = ['ufw app'] __version__ = info.version @@ -172,7 +172,9 @@ def _process(proc_data): port_set.update(range(item['start'], item['end'] + 1)) if protocol + '_list' in proc_data: - proc_data['normalized_' + protocol + '_list'] = sorted(set([p for p in proc_data[protocol + '_list'] if p not in port_set])) + new_port_list = sorted(set([p for p in proc_data[protocol + '_list'] if p not in port_set])) + if new_port_list: + proc_data['normalized_' + protocol + '_list'] = new_port_list new_port_ranges = [] state = 'findstart' # 'findstart' or 'findend'