kellyjonbrazil / jc

CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
MIT License
7.92k stars 210 forks source link

Add error type support for Linux Ping #575

Closed Mabuchin closed 2 months ago

Mabuchin commented 4 months ago

Currently linux_parse does not support icmp errors. This PR extends ICMP error parsing support to Linux environments, implements ICMP error types for IPv6, and fixes a timestamp offset issue in ping_s for error messages.

Changes

  1. Implemented ICMP error support for Linux environments
  2. Added ICMP error types for IPv6
  3. Fixed timestamp offset in ping_s for error messages

output sample

 {
  'type': 'destination_host_unreachable'
  'destination_ip': '10.0.3.22',
  'icmp_seq': 3,
  'response_ip': '10.0.0.1',
  'sent_bytes': 56,
  'timestamp': None,
},
kellyjonbrazil commented 4 months ago

Nice - thank you for the PR! I'll take a closer look and can hopefully port this over to the standard ping parser, too.