1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/proc_net_arp.md
2022-09-25 12:35:23 -07:00

1.5 KiB

Home

jc.parsers.proc_net_arp

jc - JSON Convert /proc/net/arp3 file parser

Usage (cli):

$ cat /proc/net/arp | jc --proc

or

$ jc /proc/net/arp

or

$ cat /proc/net/arp | jc --proc-net-arp

Usage (module):

import jc
result = jc.parse('proc', proc_net_arp_file)

or

import jc
result = jc.parse('proc_net_arp', proc_net_arp_file)

Schema:

[
  {
    "IP_address":           string,
    "HW_type":              string,
    "Flags":                string,
    "HW_address":           string,
    "Mask":                 string,
    "Device":               string
  }
]

Examples:

$ cat /proc/net/arp | jc --proc -p
[
  {
    "IP_address": "192.168.71.254",
    "HW_type": "0x1",
    "Flags": "0x2",
    "HW_address": "00:50:56:f3:2f:ae",
    "Mask": "*",
    "Device": "ens33"
  },
  ...
]

parse

def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]

Main text parsing function

Parameters:

data:        (string)  text data to parse
raw:         (boolean) unprocessed output if True
quiet:       (boolean) suppress warning messages if True

Returns:

List of Dictionaries. Raw or processed structured data.

Parser Information

Compatibility: linux

Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)