mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
doc update
This commit is contained in:
68
README.md
68
README.md
@ -82,6 +82,7 @@ jc PARSER [OPTIONS]
|
|||||||
- `--netstat` enables the `netstat` parser
|
- `--netstat` enables the `netstat` parser
|
||||||
- `--ps` enables the `ps` parser
|
- `--ps` enables the `ps` parser
|
||||||
- `--route` enables the `route` parser
|
- `--route` enables the `route` parser
|
||||||
|
- `--ss` enables the `ss` parser
|
||||||
- `--uname` enables the `uname -a` parser
|
- `--uname` enables the `uname -a` parser
|
||||||
- `--uptime` enables the `uptime` parser
|
- `--uptime` enables the `uptime` parser
|
||||||
- `--w` enables the `w` parser
|
- `--w` enables the `w` parser
|
||||||
@ -1022,6 +1023,73 @@ $ route -ee | jc --route -p
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
### ss
|
||||||
|
```
|
||||||
|
$ sudo ss -a | jc --ss -p
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "kernel",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd-resolve/893",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd/1",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 128,
|
||||||
|
"local_address": "127.0.0.1",
|
||||||
|
"local_port": "35485",
|
||||||
|
"peer_address": "0.0.0.0",
|
||||||
|
"peer_port": "*",
|
||||||
|
"interface": "lo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 128,
|
||||||
|
"local_address": "[::]",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"peer_address": "[::]",
|
||||||
|
"peer_port": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "v_str",
|
||||||
|
"state": "ESTAB",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "999900439",
|
||||||
|
"local_port": "1023",
|
||||||
|
"peer_address": "0",
|
||||||
|
"peer_port": "976",
|
||||||
|
"local_port_num": 1023,
|
||||||
|
"peer_port_num": 976
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
### uname -a
|
### uname -a
|
||||||
```
|
```
|
||||||
$ uname -a | jc --uname -p
|
$ uname -a | jc --uname -p
|
||||||
|
130
jc/parsers/ss.py
130
jc/parsers/ss.py
@ -5,11 +5,133 @@ Usage:
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ ss | jc --ss -p
|
$ sudo ss -a | jc --ss -p
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "kernel",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd-resolve/893",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd/1",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 128,
|
||||||
|
"local_address": "127.0.0.1",
|
||||||
|
"local_port": "35485",
|
||||||
|
"peer_address": "0.0.0.0",
|
||||||
|
"peer_port": "*",
|
||||||
|
"interface": "lo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 128,
|
||||||
|
"local_address": "[::]",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"peer_address": "[::]",
|
||||||
|
"peer_port": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "v_str",
|
||||||
|
"state": "ESTAB",
|
||||||
|
"recv_q": 0,
|
||||||
|
"send_q": 0,
|
||||||
|
"local_address": "999900439",
|
||||||
|
"local_port": "1023",
|
||||||
|
"peer_address": "0",
|
||||||
|
"peer_port": "976",
|
||||||
|
"local_port_num": 1023,
|
||||||
|
"peer_port_num": 976
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
$ ss | jc --ss -p -r
|
$ sudo ss -a | jc --ss -p -r
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "0",
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "kernel",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "0",
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd-resolve/893",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "nl",
|
||||||
|
"state": "UNCONN",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "0",
|
||||||
|
"local_address": "rtnl",
|
||||||
|
"local_port": "systemd/1",
|
||||||
|
"peer_address": "*"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "128",
|
||||||
|
"local_address": "127.0.0.1",
|
||||||
|
"local_port": "35485",
|
||||||
|
"peer_address": "0.0.0.0",
|
||||||
|
"peer_port": "*",
|
||||||
|
"interface": "lo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "tcp",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "128",
|
||||||
|
"local_address": "[::]",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"peer_address": "[::]",
|
||||||
|
"peer_port": "*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"netid": "v_str",
|
||||||
|
"state": "ESTAB",
|
||||||
|
"recv_q": "0",
|
||||||
|
"send_q": "0",
|
||||||
|
"local_address": "999900439",
|
||||||
|
"local_port": "1023",
|
||||||
|
"peer_address": "0",
|
||||||
|
"peer_port": "976"
|
||||||
|
}
|
||||||
|
]
|
||||||
"""
|
"""
|
||||||
import string
|
import string
|
||||||
import jc.utils
|
import jc.utils
|
||||||
|
Reference in New Issue
Block a user