mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
fix for blank target in rule
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
20231023 v1.23.7
|
20231024 v1.23.7
|
||||||
- xxx
|
- Fix `iptables` parser for cases where the `target` field is blank in a rule
|
||||||
|
|
||||||
20231023 v1.23.6
|
20231023 v1.23.6
|
||||||
- Fix XML parser for xmltodict library versions < 0.13.0
|
- Fix XML parser for xmltodict library versions < 0.13.0
|
||||||
|
@ -163,7 +163,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.8'
|
version = '1.9'
|
||||||
description = '`iptables` command parser'
|
description = '`iptables` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -271,6 +271,10 @@ def parse(data, raw=False, quiet=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# sometimes the "target" column is blank. Stuff in a dummy character
|
||||||
|
if headers[0] == 'target' and line.startswith(' '):
|
||||||
|
line = '\u2063' + line
|
||||||
|
|
||||||
rule = line.split(maxsplit=len(headers) - 1)
|
rule = line.split(maxsplit=len(headers) - 1)
|
||||||
temp_rule = dict(zip(headers, rule))
|
temp_rule = dict(zip(headers, rule))
|
||||||
if temp_rule:
|
if temp_rule:
|
||||||
@ -279,7 +283,4 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if chain:
|
if chain:
|
||||||
raw_output.append(chain)
|
raw_output.append(chain)
|
||||||
|
|
||||||
if raw:
|
return raw_output if raw else _process(raw_output)
|
||||||
return raw_output
|
|
||||||
else:
|
|
||||||
return _process(raw_output)
|
|
||||||
|
Reference in New Issue
Block a user