mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-10-08 23:22:21 +02:00
add ufw-appinfo to docs
This commit is contained in:
39
EXAMPLES.md
39
EXAMPLES.md
@@ -3246,6 +3246,45 @@ ufw status verbose numbered | jc --ufw -p
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### ufw app info [application]
|
||||||
|
```bash
|
||||||
|
ufw app info MSN | jc --ufw-appinfo -p # or: jc -p ufw app info MSN
|
||||||
|
```
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"profile": "MSN",
|
||||||
|
"title": "MSN Chat",
|
||||||
|
"description": "MSN chat protocol (with file transfer and voice)",
|
||||||
|
"tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"normalized_tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
### uname -a
|
### uname -a
|
||||||
```bash
|
```bash
|
||||||
uname -a | jc --uname -p # or: jc -p uname -a
|
uname -a | jc --uname -p # or: jc -p uname -a
|
||||||
|
@@ -183,6 +183,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio
|
|||||||
- `--tracepath` enables the `tracepath` and `tracepath6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath))
|
- `--tracepath` enables the `tracepath` and `tracepath6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/tracepath))
|
||||||
- `--traceroute` enables the `traceroute` and `traceroute6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute))
|
- `--traceroute` enables the `traceroute` and `traceroute6` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/traceroute))
|
||||||
- `--ufw` enables the `ufw status` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw))
|
- `--ufw` enables the `ufw status` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw))
|
||||||
|
- `--ufw-appinfo` enables the `ufw app info [application]` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/ufw_appinfo))
|
||||||
- `--uname` enables the `uname -a` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uname))
|
- `--uname` enables the `uname -a` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uname))
|
||||||
- `--upower` enables the `upower` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/upower))
|
- `--upower` enables the `upower` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/upower))
|
||||||
- `--uptime` enables the `uptime` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime))
|
- `--uptime` enables the `uptime` command parser ([documentation](https://kellyjonbrazil.github.io/jc/docs/parsers/uptime))
|
||||||
|
@@ -64,11 +64,61 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ ufw app info OpenSSH | jc --ufw-appinfo -p
|
$ ufw app info MSN | jc --ufw-appinfo -p
|
||||||
[]
|
{
|
||||||
|
"profile": "MSN",
|
||||||
|
"title": "MSN Chat",
|
||||||
|
"description": "MSN chat protocol (with file transfer and voice)",
|
||||||
|
"tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"normalized_tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
$ ufw app info OpenSSH | jc --ufw-appinfo -p -r
|
$ ufw app info MSN | jc --ufw-appinfo -p -r
|
||||||
[]
|
{
|
||||||
|
"profile": "MSN",
|
||||||
|
"title": "MSN Chat",
|
||||||
|
"description": "MSN chat protocol (with file transfer and voice)",
|
||||||
|
"tcp_list": [
|
||||||
|
"1863",
|
||||||
|
"6901"
|
||||||
|
],
|
||||||
|
"udp_list": [
|
||||||
|
"1863",
|
||||||
|
"6901"
|
||||||
|
],
|
||||||
|
"tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": "6891",
|
||||||
|
"end": "6900"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
## info
|
## info
|
||||||
|
BIN
jc/man/jc.1.gz
BIN
jc/man/jc.1.gz
Binary file not shown.
@@ -61,11 +61,61 @@ Schema:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ ufw app info OpenSSH | jc --ufw-appinfo -p
|
$ ufw app info MSN | jc --ufw-appinfo -p
|
||||||
[]
|
{
|
||||||
|
"profile": "MSN",
|
||||||
|
"title": "MSN Chat",
|
||||||
|
"description": "MSN chat protocol (with file transfer and voice)",
|
||||||
|
"tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_tcp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
],
|
||||||
|
"normalized_tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": 6891,
|
||||||
|
"end": 6900
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"normalized_udp_list": [
|
||||||
|
1863,
|
||||||
|
6901
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
$ ufw app info OpenSSH | jc --ufw-appinfo -p -r
|
$ ufw app info MSN | jc --ufw-appinfo -p -r
|
||||||
[]
|
{
|
||||||
|
"profile": "MSN",
|
||||||
|
"title": "MSN Chat",
|
||||||
|
"description": "MSN chat protocol (with file transfer and voice)",
|
||||||
|
"tcp_list": [
|
||||||
|
"1863",
|
||||||
|
"6901"
|
||||||
|
],
|
||||||
|
"udp_list": [
|
||||||
|
"1863",
|
||||||
|
"6901"
|
||||||
|
],
|
||||||
|
"tcp_ranges": [
|
||||||
|
{
|
||||||
|
"start": "6891",
|
||||||
|
"end": "6900"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
import jc.utils
|
import jc.utils
|
||||||
|
|
||||||
@@ -146,7 +196,7 @@ def _process(proc_data):
|
|||||||
|
|
||||||
|
|
||||||
def _parse_port_list(data, port_list=None):
|
def _parse_port_list(data, port_list=None):
|
||||||
"""return a list of integers"""
|
"""return a list of port strings"""
|
||||||
# 1,2,3,4,5,6,7,8,9,10,9,30,80:90,8080:8090
|
# 1,2,3,4,5,6,7,8,9,10,9,30,80:90,8080:8090
|
||||||
# overlapping and repeated port numbers are allowed
|
# overlapping and repeated port numbers are allowed
|
||||||
|
|
||||||
@@ -235,22 +285,22 @@ def parse(data, raw=False, quiet=False):
|
|||||||
line_list = line.rsplit('/', maxsplit=1)
|
line_list = line.rsplit('/', maxsplit=1)
|
||||||
if len(line_list) == 2:
|
if len(line_list) == 2:
|
||||||
if line_list[1] == 'tcp':
|
if line_list[1] == 'tcp':
|
||||||
prot_list = _parse_port_list(line_list[0])
|
tcp_prot_list = _parse_port_list(line_list[0])
|
||||||
if prot_list:
|
if tcp_prot_list:
|
||||||
raw_output['tcp_list'] = prot_list
|
raw_output['tcp_list'] = tcp_prot_list
|
||||||
|
|
||||||
prot_range = _parse_port_range(line_list[0])
|
tcp_prot_range = _parse_port_range(line_list[0])
|
||||||
if prot_range:
|
if tcp_prot_range:
|
||||||
raw_output['tcp_ranges'] = prot_range
|
raw_output['tcp_ranges'] = tcp_prot_range
|
||||||
|
|
||||||
elif line_list[1] == 'udp':
|
elif line_list[1] == 'udp':
|
||||||
prot_list = _parse_port_list(line_list[0])
|
udp_prot_list = _parse_port_list(line_list[0])
|
||||||
if prot_list:
|
if udp_prot_list:
|
||||||
raw_output['udp_list'] = prot_list
|
raw_output['udp_list'] = udp_prot_list
|
||||||
|
|
||||||
prot_range = _parse_port_range(line_list[0])
|
udp_prot_range = _parse_port_range(line_list[0])
|
||||||
if prot_range:
|
if udp_prot_range:
|
||||||
raw_output['udp_ranges'] = prot_range
|
raw_output['udp_ranges'] = udp_prot_range
|
||||||
|
|
||||||
# 'any' case
|
# 'any' case
|
||||||
else:
|
else:
|
||||||
@@ -271,10 +321,21 @@ def parse(data, raw=False, quiet=False):
|
|||||||
if 'udp_ranges' in raw_output:
|
if 'udp_ranges' in raw_output:
|
||||||
u_range = raw_output['udp_ranges']
|
u_range = raw_output['udp_ranges']
|
||||||
|
|
||||||
raw_output['tcp_list'] = _parse_port_list(line, t_list)
|
t_p_list = _parse_port_list(line, t_list)
|
||||||
raw_output['tcp_ranges'] = _parse_port_range(line, t_range)
|
if t_p_list:
|
||||||
raw_output['udp_list'] = _parse_port_list(line, u_list)
|
raw_output['tcp_list'] = t_p_list
|
||||||
raw_output['udp_ranges'] = _parse_port_range(line, u_range)
|
|
||||||
|
t_r_list = _parse_port_range(line, t_range)
|
||||||
|
if t_r_list:
|
||||||
|
raw_output['tcp_ranges'] = t_r_list
|
||||||
|
|
||||||
|
u_p_list = _parse_port_list(line, u_list)
|
||||||
|
if u_p_list:
|
||||||
|
raw_output['udp_list'] = u_p_list
|
||||||
|
|
||||||
|
u_r_list = _parse_port_range(line, u_range)
|
||||||
|
if u_r_list:
|
||||||
|
raw_output['udp_ranges'] = u_r_list
|
||||||
|
|
||||||
raw_output.update(raw_output)
|
raw_output.update(raw_output)
|
||||||
|
|
||||||
|
BIN
man/jc.1.gz
BIN
man/jc.1.gz
Binary file not shown.
Reference in New Issue
Block a user