1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

add support for pattern in osx/bsd

This commit is contained in:
Kelly Brazil
2020-07-19 14:18:40 -07:00
parent 94988d8667
commit 51f4e6927c

View File

@ -194,14 +194,22 @@ def linux_parse(data):
def bsd_parse(data):
raw_output = {}
ping_responses = []
pattern = None
footer = False
for line in filter(None, data.splitlines()):
linedata = data.splitlines()
# check for PATTERN
if linedata[0].startswith('PATTERN: '):
pattern = linedata.pop(0).split(': ')[1]
for line in filter(None, linedata):
if line.startswith('PING '):
raw_output.update(
{
'destination_ip': line.split()[2].lstrip('(').rstrip(':').rstrip(')'),
'data_bytes': line.split()[3]
'data_bytes': line.split()[3],
'pattern': pattern
}
)
continue
@ -212,7 +220,8 @@ def bsd_parse(data):
{
'source_ip': line.split()[4],
'destination_ip': line.split()[6],
'data_bytes': line.split()[1]
'data_bytes': line.split()[1],
'pattern': pattern
}
)
continue