1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

integer conversions and icmp fix

This commit is contained in:
Kelly Brazil
2020-05-20 15:39:47 -07:00
parent de52d84e82
commit 9c4fa2ae26
2 changed files with 22 additions and 2 deletions

View File

@ -359,13 +359,30 @@ def process(proc_data):
"type": string, "type": string,
"inode": integer, "inode": integer,
"path": string, "path": string,
"kind": string "kind": string,
"address": string,
"osx_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"osx_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer
} }
] ]
""" """
for entry in proc_data: for entry in proc_data:
# integer changes # integer changes
int_list = ['recv_q', 'send_q', 'pid', 'refcnt', 'inode'] int_list = ['recv_q', 'send_q', 'pid', 'refcnt', 'inode', 'unit', 'vendor', 'class',
'osx_flags', 'subcla', 'pcbcount', 'rcvbuf', 'sndbuf', 'rxbytes', 'txbytes']
for key in int_list: for key in int_list:
if key in entry: if key in entry:
try: try:

View File

@ -7,6 +7,7 @@ def normalize_headers(header):
header = header.replace('foreign address', 'foreign_address') header = header.replace('foreign address', 'foreign_address')
header = header.replace('(state)', 'state') header = header.replace('(state)', 'state')
header = header.replace('inode', 'osx_inode') header = header.replace('inode', 'osx_inode')
header = header.replace('flags', 'osx_flags')
header = header.replace('-', '_') header = header.replace('-', '_')
return header return header
@ -48,6 +49,8 @@ def parse_post(raw_data):
if entry['kind'] == 'network': if entry['kind'] == 'network':
if entry['proto'] == 'udp46': if entry['proto'] == 'udp46':
entry['transport_protocol'] = entry['proto'][:-2] entry['transport_protocol'] = entry['proto'][:-2]
elif entry['proto'].startswith('icm'):
entry['transport_protocol'] = 'icmp'
else: else:
entry['transport_protocol'] = entry['proto'][:-1] entry['transport_protocol'] = entry['proto'][:-1]