mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
add freebsd support for netstat -i
This commit is contained in:
@ -11,7 +11,7 @@ Caveats:
|
|||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
|
|
||||||
'linux', 'darwin'
|
'linux', 'darwin', 'freebsd'
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
@ -237,13 +237,13 @@ Examples:
|
|||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
version = '1.5'
|
version = '1.6'
|
||||||
description = 'netstat command parser'
|
description = 'netstat command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
|
|
||||||
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
|
||||||
compatible = ['linux', 'darwin']
|
compatible = ['linux', 'darwin', 'freebsd']
|
||||||
magic_commands = ['netstat']
|
magic_commands = ['netstat']
|
||||||
|
|
||||||
|
|
||||||
@ -319,6 +319,7 @@ def process(proc_data):
|
|||||||
"address": string,
|
"address": string,
|
||||||
"ipkts": integer, - = null
|
"ipkts": integer, - = null
|
||||||
"ierrs": integer, - = null
|
"ierrs": integer, - = null
|
||||||
|
"idrop": integer, - = null
|
||||||
"opkts": integer, - = null
|
"opkts": integer, - = null
|
||||||
"oerrs": integer, - = null
|
"oerrs": integer, - = null
|
||||||
"coll": integer, - = null
|
"coll": integer, - = null
|
||||||
@ -340,7 +341,7 @@ def process(proc_data):
|
|||||||
'osx_flags', 'subcla', 'pcbcount', 'rcvbuf', 'sndbuf', 'rxbytes', 'txbytes',
|
'osx_flags', 'subcla', 'pcbcount', 'rcvbuf', 'sndbuf', 'rxbytes', 'txbytes',
|
||||||
'route_refs', 'use', 'mtu', 'mss', 'window', 'irtt', 'metric', 'ipkts',
|
'route_refs', 'use', 'mtu', 'mss', 'window', 'irtt', 'metric', 'ipkts',
|
||||||
'ierrs', 'opkts', 'oerrs', 'coll', 'rx_ok', 'rx_err', 'rx_drp', 'rx_ovr',
|
'ierrs', 'opkts', 'oerrs', 'coll', 'rx_ok', 'rx_err', 'rx_drp', 'rx_ovr',
|
||||||
'tx_ok', 'tx_err', 'tx_drp', 'tx_ovr']
|
'tx_ok', 'tx_err', 'tx_drp', 'tx_ovr', 'idrop']
|
||||||
for key in int_list:
|
for key in int_list:
|
||||||
if key in entry:
|
if key in entry:
|
||||||
try:
|
try:
|
||||||
@ -396,7 +397,9 @@ def parse(data, raw=False, quiet=False):
|
|||||||
or cleandata[0] == 'Active kernel event sockets' \
|
or cleandata[0] == 'Active kernel event sockets' \
|
||||||
or cleandata[0] == 'Active kernel control sockets' \
|
or cleandata[0] == 'Active kernel control sockets' \
|
||||||
or cleandata[0] == 'Routing tables' \
|
or cleandata[0] == 'Routing tables' \
|
||||||
or cleandata[0] == 'Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll':
|
or cleandata[0].startswith('Name '):
|
||||||
|
# or cleandata[0] == 'Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll' \
|
||||||
|
|
||||||
import jc.parsers.netstat_osx
|
import jc.parsers.netstat_osx
|
||||||
raw_output = jc.parsers.netstat_osx.parse(cleandata)
|
raw_output = jc.parsers.netstat_osx.parse(cleandata)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ def parse(cleandata):
|
|||||||
interface_table = False
|
interface_table = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.startswith('Name Mtu '):
|
if line.startswith('Name '):
|
||||||
network = False
|
network = False
|
||||||
multipath = False
|
multipath = False
|
||||||
socket = False
|
socket = False
|
||||||
@ -232,7 +232,7 @@ def parse(cleandata):
|
|||||||
headers = header_text.split()
|
headers = header_text.split()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if interface_table and line.startswith('Name Mtu '):
|
if interface_table and line.startswith('Name '):
|
||||||
header_text = normalize_interface_headers(line)
|
header_text = normalize_interface_headers(line)
|
||||||
headers = header_text.split()
|
headers = header_text.split()
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user