diff --git a/README.md b/README.md index 8edaee88..b3672b63 100755 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ The first argument is required and identifies the command that is piping output - `--ifconfig` enables the `ifconfig` parser - `--netstat` enables the `netstat` parser - `--ps` enables the `ps` parser +- `--route` enables the `route` parser The second `-p` argument is optional and specifies whether to pretty format the JSON output. @@ -327,6 +328,52 @@ $ ps -ef | jc --ps -p ... ] ``` +### route +``` +$ route -n | jc --route -p +[ + { + "Destination": "0.0.0.0", + "Gateway": "192.168.71.2", + "Genmask": "0.0.0.0", + "Flags": "UG", + "Metric": "100", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + }, + { + "Destination": "172.17.0.0", + "Gateway": "0.0.0.0", + "Genmask": "255.255.0.0", + "Flags": "U", + "Metric": "0", + "Ref": "0", + "Use": "0", + "Iface": "docker0" + }, + { + "Destination": "192.168.71.0", + "Gateway": "0.0.0.0", + "Genmask": "255.255.255.0", + "Flags": "U", + "Metric": "0", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + }, + { + "Destination": "192.168.71.2", + "Gateway": "0.0.0.0", + "Genmask": "255.255.255.255", + "Flags": "UH", + "Metric": "100", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + } +] +``` ## Contributions Feel free to add/improve code or parsers! diff --git a/jc/parsers/route.py b/jc/parsers/route.py index 9911a738..46c8f2dd 100644 --- a/jc/parsers/route.py +++ b/jc/parsers/route.py @@ -6,7 +6,49 @@ Usage: Example: - +$ route -n | jc --route -p +[ + { + "Destination": "0.0.0.0", + "Gateway": "192.168.71.2", + "Genmask": "0.0.0.0", + "Flags": "UG", + "Metric": "100", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + }, + { + "Destination": "172.17.0.0", + "Gateway": "0.0.0.0", + "Genmask": "255.255.0.0", + "Flags": "U", + "Metric": "0", + "Ref": "0", + "Use": "0", + "Iface": "docker0" + }, + { + "Destination": "192.168.71.0", + "Gateway": "0.0.0.0", + "Genmask": "255.255.255.0", + "Flags": "U", + "Metric": "0", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + }, + { + "Destination": "192.168.71.2", + "Gateway": "0.0.0.0", + "Genmask": "255.255.255.255", + "Flags": "UH", + "Metric": "100", + "Ref": "0", + "Use": "0", + "Iface": "ens33" + } +] """