1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

update ufw app info docs to support multiple apps (ufw app info all)

This commit is contained in:
Kelly Brazil
2021-04-26 10:02:02 -07:00
parent a683f68003
commit 72207c54ee
3 changed files with 102 additions and 94 deletions

View File

@ -3,6 +3,8 @@
# jc.parsers.ufw_appinfo # jc.parsers.ufw_appinfo
jc - JSON CLI output utility `ufw app info [application]` command output parser jc - JSON CLI output utility `ufw app info [application]` command output parser
Supports individual apps via `ufw app info [application]` and all apps list via `ufw app info all`.
Because `ufw` application definitions allow overlapping ports and port ranges, this parser preserves that behavior, but also provides `normalized` lists and ranges that remove duplicate ports and merge overlapping ranges. Because `ufw` application definitions allow overlapping ports and port ranges, this parser preserves that behavior, but also provides `normalized` lists and ranges that remove duplicate ports and merge overlapping ranges.
Usage (cli): Usage (cli):
@ -20,105 +22,111 @@ Usage (module):
Schema: Schema:
{ [
"profile": string, {
"title": string, "profile": string,
"description": string, "title": string,
"tcp_list": [ "description": string,
integer "tcp_list": [
], integer
"tcp_ranges": [ ],
{ "tcp_ranges": [
"start": integer, # 'any' is converted to start/end: 0/65535 {
"end": integer "start": integer, # 'any' is converted to start/end: 0/65535
} "end": integer
], }
"udp_list": [ ],
integer "udp_list": [
], integer
"udp_ranges": [ ],
{ "udp_ranges": [
"start": integer, # 'any' is converted to start/end: 0/65535 {
"end": integer "start": integer, # 'any' is converted to start/end: 0/65535
} "end": integer
], }
"normalized_tcp_list": [ ],
integers # duplicates and overlapping are removed "normalized_tcp_list": [
], integers # duplicates and overlapping are removed
"normalized_tcp_ranges": [ ],
{ "normalized_tcp_ranges": [
"start": integer, # 'any' is converted to start/end: 0/65535 {
"end": integers # overlapping are merged "start": integer, # 'any' is converted to start/end: 0/65535
} "end": integers # overlapping are merged
], }
"normalized_udp_list": [ ],
integers # duplicates and overlapping are removed "normalized_udp_list": [
], integers # duplicates and overlapping are removed
"normalized_udp_ranges": [ ],
{ "normalized_udp_ranges": [
"start": integer, # 'any' is converted to start/end: 0/65535 {
"end": integers # overlapping are merged "start": integer, # 'any' is converted to start/end: 0/65535
} "end": integers # overlapping are merged
] }
} ]
}
]
Examples: Examples:
$ ufw app info MSN | jc --ufw-appinfo -p $ ufw app info MSN | jc --ufw-appinfo -p
{ [
"profile": "MSN", {
"title": "MSN Chat", "profile": "MSN",
"description": "MSN chat protocol (with file transfer and voice)", "title": "MSN Chat",
"tcp_list": [ "description": "MSN chat protocol (with file transfer and voice)",
1863, "tcp_list": [
6901 1863,
], 6901
"udp_list": [ ],
1863, "udp_list": [
6901 1863,
], 6901
"tcp_ranges": [ ],
{ "tcp_ranges": [
"start": 6891, {
"end": 6900 "start": 6891,
} "end": 6900
], }
"normalized_tcp_list": [ ],
1863, "normalized_tcp_list": [
6901 1863,
], 6901
"normalized_tcp_ranges": [ ],
{ "normalized_tcp_ranges": [
"start": 6891, {
"end": 6900 "start": 6891,
} "end": 6900
], }
"normalized_udp_list": [ ],
1863, "normalized_udp_list": [
6901 1863,
] 6901
} ]
}
]
$ ufw app info MSN | jc --ufw-appinfo -p -r $ ufw app info MSN | jc --ufw-appinfo -p -r
{ [
"profile": "MSN", {
"title": "MSN Chat", "profile": "MSN",
"description": "MSN chat protocol (with file transfer and voice)", "title": "MSN Chat",
"tcp_list": [ "description": "MSN chat protocol (with file transfer and voice)",
"1863", "tcp_list": [
"6901" "1863",
], "6901"
"udp_list": [ ],
"1863", "udp_list": [
"6901" "1863",
], "6901"
"tcp_ranges": [ ],
{ "tcp_ranges": [
"start": "6891", {
"end": "6900" "start": "6891",
} "end": "6900"
] }
} ]
}
]
## info ## info
@ -142,7 +150,7 @@ Parameters:
Returns: Returns:
Dictionary. Raw or processed structured data. List of Dictionaries. Raw or processed structured data.
## Parser Information ## Parser Information
Compatibility: linux Compatibility: linux

Binary file not shown.

Binary file not shown.