mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
111 lines
2.1 KiB
Markdown
111 lines
2.1 KiB
Markdown
![]() |
# jc.parsers.arp
|
||
|
jc - JSON CLI output utility arp Parser
|
||
|
|
||
|
Usage:
|
||
|
specify --arp as the first argument if the piped input is coming from arp
|
||
|
|
||
|
Examples:
|
||
|
|
||
|
$ arp | jc --arp -p
|
||
|
[
|
||
|
{
|
||
|
"address": "192.168.71.254",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f0:98:26",
|
||
|
"flags_mask": "C",
|
||
|
"iface": "ens33"
|
||
|
},
|
||
|
{
|
||
|
"address": "gateway",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f7:4a:fc",
|
||
|
"flags_mask": "C",
|
||
|
"iface": "ens33"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
$ arp | jc --arp -p -r
|
||
|
[
|
||
|
{
|
||
|
"address": "gateway",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f7:4a:fc",
|
||
|
"flags_mask": "C",
|
||
|
"iface": "ens33"
|
||
|
},
|
||
|
{
|
||
|
"address": "192.168.71.254",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:fe:7a:b4",
|
||
|
"flags_mask": "C",
|
||
|
"iface": "ens33"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
$ arp -a | jc --arp -p
|
||
|
[
|
||
|
{
|
||
|
"name": null,
|
||
|
"address": "192.168.71.254",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f0:98:26",
|
||
|
"iface": "ens33"
|
||
|
},
|
||
|
{
|
||
|
"name": "gateway",
|
||
|
"address": "192.168.71.2",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f7:4a:fc",
|
||
|
"iface": "ens33"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
$ arp -a | jc --arp -p -r
|
||
|
[
|
||
|
{
|
||
|
"name": "?",
|
||
|
"address": "192.168.71.254",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:fe:7a:b4",
|
||
|
"iface": "ens33"
|
||
|
},
|
||
|
{
|
||
|
"name": "_gateway",
|
||
|
"address": "192.168.71.2",
|
||
|
"hwtype": "ether",
|
||
|
"hwaddress": "00:50:56:f7:4a:fc",
|
||
|
"iface": "ens33"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
## process
|
||
|
```python
|
||
|
process(proc_data)
|
||
|
```
|
||
|
|
||
|
schema:
|
||
|
|
||
|
[
|
||
|
{
|
||
|
"name": string,
|
||
|
"address": string,
|
||
|
"hwtype": string,
|
||
|
"hwaddress": string,
|
||
|
"flags_mask": string,
|
||
|
"iface": string
|
||
|
}
|
||
|
]
|
||
|
|
||
|
## parse
|
||
|
```python
|
||
|
parse(data, raw=False, quiet=False)
|
||
|
```
|
||
|
|
||
|
Main parsing function
|
||
|
|
||
|
Arguments:
|
||
|
|
||
|
raw: (boolean) output preprocessed JSON if True
|
||
|
quiet: (boolean) suppress warning messages if True
|
||
|
|