From d46fc8bbfa15a80a1af6c64f70230f858c215223 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Tue, 20 Apr 2021 21:58:52 -0700 Subject: [PATCH] set to/from_transport to None if to/from_service is set --- jc/parsers/ufw.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jc/parsers/ufw.py b/jc/parsers/ufw.py index e9f9ed41..71df9295 100644 --- a/jc/parsers/ufw.py +++ b/jc/parsers/ufw.py @@ -30,17 +30,17 @@ Schema: "to_ip": string, "to_subnet": integer, "to_interface": string, - "to_transport": string, + "to_transport": string, # null if to_service is set "to_start_port": integer, # null if to_service is set "to_end_port": integer, # null if to_service is set - "to_service": string, # null if start/end ports above set + "to_service": string, # null if any above are set "from_ip": string, "from_subnet": integer, "from_interface": string, - "from_transport": string, + "from_transport": string, # null if from_service is set "from_start_port": integer, # null if from_service is set "from_end_port": integer, # null if from_service is set - "from_service": string, # null if start/end ports above set + "from_service": string, # null if any above are set } ] } @@ -394,6 +394,7 @@ def _parse_to_from(linedata, direction, rule_obj=None): rule_obj[direction + '_service'] = linedata.strip() rule_obj[direction + '_start_port'] = None rule_obj[direction + '_end_port'] = None + rule_obj[direction + '_transport'] = None # check if to/from IP addresses exist. If not, set to 0.0.0.0/0 or ::/0 if direction + '_ip' not in rule_obj: