From 604ade791f7bd33b37f64916befba27a2ea08b5b Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 17 Jul 2020 15:57:07 -0700 Subject: [PATCH] add ping parser --- jc/parsers/ping.py | 325 ++++++++++++++++++ .../centos-7.7/ping-hostname-O-D-p-s.out | 26 ++ .../fixtures/centos-7.7/ping-hostname-O-p.out | 26 ++ tests/fixtures/centos-7.7/ping-hostname-O.out | 25 ++ .../centos-7.7/ping6-hostname-O-D-p-s.out | 26 ++ .../centos-7.7/ping6-hostname-O-p.out | 26 ++ tests/fixtures/centos-7.7/ping6-ip-O-D-p.out | 26 ++ tests/fixtures/centos-7.7/ping6-ip-O-p.out | 26 ++ 8 files changed, 506 insertions(+) create mode 100644 jc/parsers/ping.py create mode 100644 tests/fixtures/centos-7.7/ping-hostname-O-D-p-s.out create mode 100644 tests/fixtures/centos-7.7/ping-hostname-O-p.out create mode 100644 tests/fixtures/centos-7.7/ping-hostname-O.out create mode 100644 tests/fixtures/centos-7.7/ping6-hostname-O-D-p-s.out create mode 100644 tests/fixtures/centos-7.7/ping6-hostname-O-p.out create mode 100644 tests/fixtures/centos-7.7/ping6-ip-O-D-p.out create mode 100644 tests/fixtures/centos-7.7/ping6-ip-O-p.out diff --git a/jc/parsers/ping.py b/jc/parsers/ping.py new file mode 100644 index 00000000..13b91e3c --- /dev/null +++ b/jc/parsers/ping.py @@ -0,0 +1,325 @@ +"""jc - JSON CLI output utility ping Parser + +Usage: + + specify --ping as the first argument if the piped input is coming from ping + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ ping | jc --ping -p + [] + + $ ping | jc --ping -p -r + [] +""" +import string +import jc.utils + + +class info(): + version = '1.0' + description = 'ping command parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + # details = 'enter any other details here' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + magic_commands = ['ping', 'ping6'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + List of dictionaries. Structured data with the following schema: + + [ + { + "ping": string, + "bar": boolean, + "baz": integer + } + ] + """ + + # rebuild output for added semantic information + return proc_data + + +def linux_parse(data): + raw_output = {} + ping_responses = [] + pattern = None + footer = False + + linedata = data.splitlines() + + # check for PATTERN + if linedata[0].startswith('PATTERN: '): + pattern = linedata.pop(0).split(': ')[1] + + ipv4 = True if 'bytes of data' in linedata[0] else False + + if ipv4 and linedata[0][5] not in string.digits: + hostname = True + elif ipv4 and linedata[0][5] in string.digits: + hostname = False + elif not ipv4 and ' (' in linedata[0]: + hostname = True + else: + hostname = False + + for line in filter(None, linedata): + if line.startswith('PING '): + if ipv4 and not hostname: + dst_ip, dta_byts = (2, 3) + elif ipv4 and hostname: + dst_ip, dta_byts = (2, 3) + elif not ipv4 and not hostname: + dst_ip, dta_byts = (2, 3) + else: + dst_ip, dta_byts = (3, 4) + + line = line.replace('(', ' ').replace(')', ' ') + raw_output.update( + { + 'destination_ip': line.split()[dst_ip].lstrip('(').rstrip(')'), + 'data_bytes': line.split()[dta_byts], + 'pattern': pattern + } + ) + continue + + if line.startswith('---'): + footer = True + raw_output['destination'] = line.split()[1] + continue + + if footer: + if 'packets transmitted' in line: + raw_output.update( + { + 'packets_transmitted': line.split()[0], + 'packets_received': line.split()[3], + 'packet_loss_percent': line.split()[5].rstrip('%'), + 'time_ms': line.split()[9].replace('ms', '') + } + ) + continue + + else: + split_line = line.split(' = ')[1] + split_line = split_line.split('/') + raw_output.update( + { + 'round_trip_ms_min': split_line[0], + 'round_trip_ms_avg': split_line[1], + 'round_trip_ms_max': split_line[2], + 'round_trip_ms_stddev': split_line[3].replace(' ms', '') + } + ) + + # ping response lines + else: + # request timeout + if 'no answer yet for icmp_seq=' in line: + timestamp = False + isequence = 5 + + # if timestamp option is specified, then shift icmp sequence field right by one + if line[0] == '[': + timestamp = True + isequence = 6 + + response = { + 'request_timeout': True, + 'timestamp': line.split()[0].lstrip('[').rstrip(']') if timestamp else None, + 'icmp_seq': line.replace('=', ' ').split()[isequence] + } + ping_responses.append(response) + continue + + # normal responses + else: + hostname = True if '(' in line else False + line = line.replace('(', ' ').replace(')', ' ').replace('=', ' ') + + # positions of items depend on whether ipv4/ipv6 and/or ip/hostname is used + if ipv4 and not hostname: + bts, rip, iseq, t2l, tms = (0, 3, 5, 7, 9) + elif ipv4 and hostname: + bts, rip, iseq, t2l, tms = (0, 4, 7, 9, 11) + elif not ipv4 and not hostname: + bts, rip, iseq, t2l, tms = (0, 3, 5, 7, 9) + elif not ipv4 and hostname: + bts, rip, iseq, t2l, tms = (0, 4, 7, 9, 11) + + # if timestamp option is specified, then shift everything right by one + timestamp = False + if line[0] == '[': + timestamp = True + bts, rip, iseq, t2l, tms = (bts + 1, rip + 1, iseq + 1, t2l + 1, tms + 1) + + response = { + 'request_timeout': False, + 'timestamp': line.split()[0].lstrip('[').rstrip(']') if timestamp else None, + 'bytes': line.split()[bts], + 'response_ip': line.split()[rip].rstrip(':'), + 'icmp_seq': line.split()[iseq], + 'ttl': line.split()[t2l], + 'time_ms': line.split()[tms] + } + ping_responses.append(response) + continue + + raw_output['responses'] = ping_responses + + return raw_output + + +def bsd_parse(data): + raw_output = {} + ping_responses = [] + footer = False + + for line in filter(None, data.splitlines()): + if line.startswith('PING '): + raw_output.update( + { + 'destination_ip': line.split()[2].lstrip('(').rstrip(':').rstrip(')'), + 'data_bytes': line.split()[3] + } + ) + continue + + if line.startswith('PING6('): + line = line.replace('(', ' ').replace(')', ' ').replace('=', ' ') + raw_output.update( + { + 'source_ip': line.split()[4], + 'destination_ip': line.split()[6], + 'data_bytes': line.split()[1] + } + ) + continue + + if line.startswith('---'): + footer = True + raw_output['destination'] = line.split()[1] + continue + + if footer: + if 'packets transmitted' in line: + raw_output.update( + { + 'packets_transmitted': line.split()[0], + 'packets_received': line.split()[3], + 'packet_loss_percent': line.split()[6].rstrip('%') + } + ) + continue + + else: + split_line = line.split(' = ')[1] + split_line = split_line.split('/') + raw_output.update( + { + 'round_trip_ms_min': split_line[0], + 'round_trip_ms_avg': split_line[1], + 'round_trip_ms_max': split_line[2], + 'round_trip_ms_stddev': split_line[3].replace(' ms', '') + } + ) + + # ping response lines + else: + # ipv4 lines + if ',' not in line: + + # request timeout + if line.startswith('Request timeout for '): + response = { + 'request_timeout': True, + 'icmp_seq': line.split()[4] + } + ping_responses.append(response) + continue + + # normal response + else: + line = line.replace(':', ' ').replace('=', ' ') + response = { + 'request_timeout': False, + 'bytes': line.split()[0], + 'response_ip': line.split()[3], + 'icmp_seq': line.split()[5], + 'ttl': line.split()[7], + 'time_ms': line.split()[9] + } + ping_responses.append(response) + continue + + # ipv6 lines + else: + line = line.replace(',', ' ').replace('=', ' ') + response = { + 'request_timeout': False, + 'bytes': line.split()[0], + 'response_ip': line.split()[3], + 'icmp_seq': line.split()[5], + 'ttl': line.split()[7], + 'time_ms': line.split()[9] + } + ping_responses.append(response) + continue + + raw_output['responses'] = ping_responses + + return raw_output + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + List of dictionaries. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = {} + + if jc.utils.has_data(data): + + if 'time' in data.splitlines()[-2]: + raw_output = linux_parse(data) + else: + raw_output = bsd_parse(data) + + if raw: + return raw_output + else: + return process(raw_output) + diff --git a/tests/fixtures/centos-7.7/ping-hostname-O-D-p-s.out b/tests/fixtures/centos-7.7/ping-hostname-O-D-p-s.out new file mode 100644 index 00000000..968ece83 --- /dev/null +++ b/tests/fixtures/centos-7.7/ping-hostname-O-D-p-s.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING turner-tls.map.fastly.net (151.101.189.67) 1400(1428) bytes of data. +[1594978465.914536] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=1 ttl=59 time=31.4 ms +[1594978465.993009] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=2 ttl=59 time=30.3 ms +[1594978467.010196] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=3 ttl=59 time=32.0 ms +[1594978468.033743] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=4 ttl=59 time=38.8 ms +[1594978469.051227] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=5 ttl=59 time=38.0 ms +[1594978470.048764] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=6 ttl=59 time=29.9 ms +[1594978471.051945] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=7 ttl=59 time=28.9 ms +[1594978472.064206] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=8 ttl=59 time=37.4 ms +[1594978473.062587] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=9 ttl=59 time=31.5 ms +[1594978474.074343] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=10 ttl=59 time=38.3 ms +[1594978475.079703] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=11 ttl=59 time=38.8 ms +[1594978476.076383] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=12 ttl=59 time=30.7 ms +[1594978477.084119] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=13 ttl=59 time=30.7 ms +[1594978478.092207] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=14 ttl=59 time=31.6 ms +[1594978479.104358] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=15 ttl=59 time=37.7 ms +[1594978480.106907] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=16 ttl=59 time=37.5 ms +[1594978481.115580] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=17 ttl=59 time=37.3 ms +[1594978482.119872] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=18 ttl=59 time=33.8 ms +[1594978483.131901] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=19 ttl=59 time=37.0 ms +[1594978484.141117] 1408 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=20 ttl=59 time=36.9 ms + +--- turner-tls.map.fastly.net ping statistics --- +20 packets transmitted, 20 received, 0% packet loss, time 19146ms +rtt min/avg/max/mdev = 28.960/34.468/38.892/3.497 ms diff --git a/tests/fixtures/centos-7.7/ping-hostname-O-p.out b/tests/fixtures/centos-7.7/ping-hostname-O-p.out new file mode 100644 index 00000000..ea26b2e3 --- /dev/null +++ b/tests/fixtures/centos-7.7/ping-hostname-O-p.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING turner-tls.map.fastly.net (151.101.129.67) 56(84) bytes of data. +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=1 ttl=59 time=24.4 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=2 ttl=59 time=23.3 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=3 ttl=59 time=32.6 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=4 ttl=59 time=32.6 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=5 ttl=59 time=26.9 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=6 ttl=59 time=24.1 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=7 ttl=59 time=24.6 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=8 ttl=59 time=33.9 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=9 ttl=59 time=32.7 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=10 ttl=59 time=31.2 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=11 ttl=59 time=25.7 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=12 ttl=59 time=33.8 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=13 ttl=59 time=23.7 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=14 ttl=59 time=23.9 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=15 ttl=59 time=33.6 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=16 ttl=59 time=24.5 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=17 ttl=59 time=30.1 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=18 ttl=59 time=24.1 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=19 ttl=59 time=32.2 ms +64 bytes from 151.101.129.67 (151.101.129.67): icmp_seq=20 ttl=59 time=31.0 ms + +--- turner-tls.map.fastly.net ping statistics --- +20 packets transmitted, 20 received, 0% packet loss, time 19233ms +rtt min/avg/max/mdev = 23.359/28.495/33.979/4.081 ms diff --git a/tests/fixtures/centos-7.7/ping-hostname-O.out b/tests/fixtures/centos-7.7/ping-hostname-O.out new file mode 100644 index 00000000..4eab9054 --- /dev/null +++ b/tests/fixtures/centos-7.7/ping-hostname-O.out @@ -0,0 +1,25 @@ +PING turner-tls.map.fastly.net (151.101.189.67) 56(84) bytes of data. +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=1 ttl=59 time=29.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=2 ttl=59 time=30.1 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=3 ttl=59 time=35.5 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=4 ttl=59 time=35.5 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=5 ttl=59 time=34.9 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=6 ttl=59 time=29.9 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=7 ttl=59 time=27.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=8 ttl=59 time=28.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=9 ttl=59 time=35.2 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=10 ttl=59 time=34.4 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=11 ttl=59 time=35.9 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=12 ttl=59 time=35.8 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=13 ttl=59 time=34.4 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=14 ttl=59 time=35.5 ms +no answer yet for icmp_seq=15 +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=16 ttl=59 time=36.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=17 ttl=59 time=34.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=18 ttl=59 time=34.6 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=19 ttl=59 time=36.7 ms +64 bytes from 151.101.189.67 (151.101.189.67): icmp_seq=20 ttl=59 time=34.3 ms + +--- turner-tls.map.fastly.net ping statistics --- +20 packets transmitted, 19 received, 5% packet loss, time 19125ms +rtt min/avg/max/mdev = 27.656/33.717/36.758/2.814 ms diff --git a/tests/fixtures/centos-7.7/ping6-hostname-O-D-p-s.out b/tests/fixtures/centos-7.7/ping6-hostname-O-D-p-s.out new file mode 100644 index 00000000..5303338a --- /dev/null +++ b/tests/fixtures/centos-7.7/ping6-hostname-O-D-p-s.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING www.cnn.com(2a04:4e42:2d::323 (2a04:4e42:2d::323)) 1400 data bytes +[1594978345.609669] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=1 ttl=59 time=32.4 ms +[1594978346.585420] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=2 ttl=59 time=39.9 ms +[1594978347.594128] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=3 ttl=59 time=42.3 ms +[1594978348.595221] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=4 ttl=59 time=40.2 ms +[1594978349.600372] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=5 ttl=59 time=43.2 ms +[1594978350.590676] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=6 ttl=59 time=31.8 ms +[1594978351.601527] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=7 ttl=59 time=41.8 ms +[1594978352.604195] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=8 ttl=59 time=41.7 ms +[1594978353.607212] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=9 ttl=59 time=42.0 ms +[1594978354.610771] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=10 ttl=59 time=40.7 ms +[1594978355.613729] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=11 ttl=59 time=40.4 ms +[1594978356.611887] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=12 ttl=59 time=32.6 ms +[1594978357.624810] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=13 ttl=59 time=40.1 ms +[1594978358.629185] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=14 ttl=59 time=42.0 ms +[1594978359.634854] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=15 ttl=59 time=41.2 ms +[1594978360.638344] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=16 ttl=59 time=40.6 ms +[1594978361.640968] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=17 ttl=59 time=40.7 ms +[1594978362.645739] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=18 ttl=59 time=39.9 ms +[1594978363.646700] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=19 ttl=59 time=37.5 ms +[1594978364.650853] 1408 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=20 ttl=59 time=33.6 ms + +--- www.cnn.com ping statistics --- +20 packets transmitted, 20 received, 0% packet loss, time 19077ms +rtt min/avg/max/mdev = 31.845/39.274/43.243/3.522 ms diff --git a/tests/fixtures/centos-7.7/ping6-hostname-O-p.out b/tests/fixtures/centos-7.7/ping6-hostname-O-p.out new file mode 100644 index 00000000..3fe6163a --- /dev/null +++ b/tests/fixtures/centos-7.7/ping6-hostname-O-p.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING www.cnn.com(2a04:4e42:2d::323 (2a04:4e42:2d::323)) 56 data bytes +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=1 ttl=59 time=30.9 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=2 ttl=59 time=39.0 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=3 ttl=59 time=32.6 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=4 ttl=59 time=38.4 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=5 ttl=59 time=38.8 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=6 ttl=59 time=42.6 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=7 ttl=59 time=30.7 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=8 ttl=59 time=39.4 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=9 ttl=59 time=39.3 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=10 ttl=59 time=38.9 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=11 ttl=59 time=38.6 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=12 ttl=59 time=38.2 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=13 ttl=59 time=39.6 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=14 ttl=59 time=37.4 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=15 ttl=59 time=33.7 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=16 ttl=59 time=39.4 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=17 ttl=59 time=38.9 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=18 ttl=59 time=41.3 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=19 ttl=59 time=32.2 ms +64 bytes from 2a04:4e42:2d::323 (2a04:4e42:2d::323): icmp_seq=20 ttl=59 time=38.4 ms + +--- www.cnn.com ping statistics --- +20 packets transmitted, 20 received, 0% packet loss, time 19164ms +rtt min/avg/max/mdev = 30.757/37.455/42.652/3.338 ms diff --git a/tests/fixtures/centos-7.7/ping6-ip-O-D-p.out b/tests/fixtures/centos-7.7/ping6-ip-O-D-p.out new file mode 100644 index 00000000..89f7f619 --- /dev/null +++ b/tests/fixtures/centos-7.7/ping6-ip-O-D-p.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING 2a04:4e42:600::323(2a04:4e42:600::323) 56 data bytes +[1594976827.240914] 64 bytes from 2a04:4e42:600::323: icmp_seq=1 ttl=59 time=28.7 ms +[1594976828.254930] 64 bytes from 2a04:4e42:600::323: icmp_seq=2 ttl=59 time=37.2 ms +[1594976829.252877] 64 bytes from 2a04:4e42:600::323: icmp_seq=3 ttl=59 time=29.7 ms +[1594976830.262654] 64 bytes from 2a04:4e42:600::323: icmp_seq=4 ttl=59 time=37.7 ms +[1594976831.265626] 64 bytes from 2a04:4e42:600::323: icmp_seq=5 ttl=59 time=34.8 ms +[1594976832.269834] 64 bytes from 2a04:4e42:600::323: icmp_seq=6 ttl=59 time=35.6 ms +[1594976833.268059] 64 bytes from 2a04:4e42:600::323: icmp_seq=7 ttl=59 time=28.4 ms +[1594976834.274292] 64 bytes from 2a04:4e42:600::323: icmp_seq=8 ttl=59 time=28.1 ms +[1594976835.287123] 64 bytes from 2a04:4e42:600::323: icmp_seq=9 ttl=59 time=34.9 ms +[1594976836.287707] 64 bytes from 2a04:4e42:600::323: icmp_seq=10 ttl=59 time=34.4 ms +[1594976837.290589] 64 bytes from 2a04:4e42:600::323: icmp_seq=11 ttl=59 time=35.2 ms +[1594976838.293514] 64 bytes from 2a04:4e42:600::323: icmp_seq=12 ttl=59 time=35.4 ms +[1594976839.290914] 64 bytes from 2a04:4e42:600::323: icmp_seq=13 ttl=59 time=29.8 ms +[1594976840.292897] 64 bytes from 2a04:4e42:600::323: icmp_seq=14 ttl=59 time=28.5 ms +[1594976842.269238] no answer yet for icmp_seq=15 +[1594976842.301450] 64 bytes from 2a04:4e42:600::323: icmp_seq=16 ttl=59 time=31.8 ms +[1594976843.312998] 64 bytes from 2a04:4e42:600::323: icmp_seq=17 ttl=59 time=39.8 ms +[1594976844.314228] 64 bytes from 2a04:4e42:600::323: icmp_seq=18 ttl=59 time=35.7 ms +[1594976845.315518] 64 bytes from 2a04:4e42:600::323: icmp_seq=19 ttl=59 time=35.1 ms +[1594976846.321706] 64 bytes from 2a04:4e42:600::323: icmp_seq=20 ttl=59 time=35.4 ms + +--- 2a04:4e42:600::323 ping statistics --- +20 packets transmitted, 19 received, 5% packet loss, time 19074ms +rtt min/avg/max/mdev = 28.150/33.534/39.843/3.489 ms diff --git a/tests/fixtures/centos-7.7/ping6-ip-O-p.out b/tests/fixtures/centos-7.7/ping6-ip-O-p.out new file mode 100644 index 00000000..934ff078 --- /dev/null +++ b/tests/fixtures/centos-7.7/ping6-ip-O-p.out @@ -0,0 +1,26 @@ +PATTERN: 0xabcd +PING 2a04:4e42:600::323(2a04:4e42:600::323) 56 data bytes +64 bytes from 2a04:4e42:600::323: icmp_seq=1 ttl=59 time=27.9 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=2 ttl=59 time=28.4 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=3 ttl=59 time=36.0 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=4 ttl=59 time=28.5 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=5 ttl=59 time=35.8 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=6 ttl=59 time=34.4 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=7 ttl=59 time=30.7 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=8 ttl=59 time=28.5 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=9 ttl=59 time=36.5 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=10 ttl=59 time=36.3 ms +no answer yet for icmp_seq=11 +64 bytes from 2a04:4e42:600::323: icmp_seq=12 ttl=59 time=37.4 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=13 ttl=59 time=30.7 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=14 ttl=59 time=36.5 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=15 ttl=59 time=35.4 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=16 ttl=59 time=36.3 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=17 ttl=59 time=37.5 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=18 ttl=59 time=36.2 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=19 ttl=59 time=27.0 ms +64 bytes from 2a04:4e42:600::323: icmp_seq=20 ttl=59 time=38.1 ms + +--- 2a04:4e42:600::323 ping statistics --- +20 packets transmitted, 19 received, 5% packet loss, time 19067ms +rtt min/avg/max/mdev = 27.064/33.626/38.146/3.803 ms