mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
documentation updates
This commit is contained in:
124
README.md
124
README.md
@ -128,6 +128,130 @@ $ ifconfig | jc --ifconfig -p
|
|||||||
"metric": null
|
"metric": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
$ netstat -p | jc --netstat -p
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"tcp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost.localdo",
|
||||||
|
"local_port": "34480",
|
||||||
|
"foreign_address": "lb-192-30-255-113",
|
||||||
|
"foreign_port": "https",
|
||||||
|
"state": "ESTABLISHED",
|
||||||
|
"pid": "53550",
|
||||||
|
"program_name": "git-remote-ht",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "localhost.localdo",
|
||||||
|
"local_port": "34478",
|
||||||
|
"foreign_address": "lb-192-30-255-113",
|
||||||
|
"foreign_port": "https",
|
||||||
|
"state": "ESTABLISHED",
|
||||||
|
"pid": "53550",
|
||||||
|
"program_name": "git-remote-ht",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ netstat -lp | jc --netstat -p
|
||||||
|
{
|
||||||
|
"server": {
|
||||||
|
"tcp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "smtp",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "1594",
|
||||||
|
"program_name": "master",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "0.0.0.0",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "21918",
|
||||||
|
"program_name": "sshd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ipv6": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "smtp",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "1594",
|
||||||
|
"program_name": "master",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "[::]",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "21918",
|
||||||
|
"program_name": "sshd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"udp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "0.0.0.0",
|
||||||
|
"local_port": "bootpc",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "13903",
|
||||||
|
"program_name": "dhclient",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "323",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "30926",
|
||||||
|
"program_name": "chronyd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ipv6": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "323",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "30926",
|
||||||
|
"program_name": "chronyd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,138 @@
|
|||||||
"""jc - JSON CLI output utility netstat Parser
|
"""jc - JSON CLI output utility netstat Parser
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
specify --netstat as the first argument if the piped input is coming from netstat
|
Specify --netstat as the first argument if the piped input is coming from netstat
|
||||||
|
|
||||||
Example:
|
Supports -lnp netstat options
|
||||||
|
|
||||||
$ netstat | jc --netstat -p
|
Limitations:
|
||||||
|
Only supports TCP and UDP
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ netstat -p | jc --netstat -p
|
||||||
|
{
|
||||||
|
"client": {
|
||||||
|
"tcp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost.localdo",
|
||||||
|
"local_port": "34480",
|
||||||
|
"foreign_address": "lb-192-30-255-113",
|
||||||
|
"foreign_port": "https",
|
||||||
|
"state": "ESTABLISHED",
|
||||||
|
"pid": "53550",
|
||||||
|
"program_name": "git-remote-ht",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "localhost.localdo",
|
||||||
|
"local_port": "34478",
|
||||||
|
"foreign_address": "lb-192-30-255-113",
|
||||||
|
"foreign_port": "https",
|
||||||
|
"state": "ESTABLISHED",
|
||||||
|
"pid": "53550",
|
||||||
|
"program_name": "git-remote-ht",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ netstat -lp | jc --netstat -p
|
$ netstat -lp | jc --netstat -p
|
||||||
|
{
|
||||||
|
"server": {
|
||||||
|
"tcp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "smtp",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "1594",
|
||||||
|
"program_name": "master",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "0.0.0.0",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "21918",
|
||||||
|
"program_name": "sshd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ipv6": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "smtp",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "1594",
|
||||||
|
"program_name": "master",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "[::]",
|
||||||
|
"local_port": "ssh",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"state": "LISTEN",
|
||||||
|
"pid": "21918",
|
||||||
|
"program_name": "sshd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"udp": {
|
||||||
|
"ipv4": [
|
||||||
|
{
|
||||||
|
"local_address": "0.0.0.0",
|
||||||
|
"local_port": "bootpc",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "13903",
|
||||||
|
"program_name": "dhclient",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "323",
|
||||||
|
"foreign_address": "0.0.0.0",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "30926",
|
||||||
|
"program_name": "chronyd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ipv6": [
|
||||||
|
{
|
||||||
|
"local_address": "localhost",
|
||||||
|
"local_port": "323",
|
||||||
|
"foreign_address": "[::]",
|
||||||
|
"foreign_port": "*",
|
||||||
|
"pid": "30926",
|
||||||
|
"program_name": "chronyd",
|
||||||
|
"receive_q": 0,
|
||||||
|
"send_q": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user