1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-08-06 22:32:54 +02:00

Merge pull request #64 from kellyjonbrazil/dev

Dev v1.11.2
This commit is contained in:
Kelly Brazil
2020-05-30 20:08:32 -07:00
committed by GitHub
79 changed files with 1193 additions and 251 deletions

View File

@ -205,6 +205,8 @@ Tested on:
- Fedora32
- OSX 10.11.6
- OSX 10.14.6
- NixOS
- FreeBSD12
## Contributions
Feel free to add/improve code or parsers! You can use the [`jc/parsers/foo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/foo.py) parser as a template and submit your parser with a pull request.
@ -314,21 +316,25 @@ $ arp -a | jc --arp -p # or: jc -p arp -a
"address": "192.168.71.1",
"hwtype": "ether",
"hwaddress": "00:50:56:c0:00:08",
"iface": "ens33"
"iface": "ens33",
"permanent": true
},
{
"name": null,
"address": "192.168.71.254",
"hwtype": "ether",
"hwaddress": "00:50:56:fe:7a:b4",
"iface": "ens33"
"iface": "ens33",
"permanent": true
},
{
"name": "_gateway",
"address": "192.168.71.2",
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"iface": "ens33",
"permanent": false,
"expires": 110
}
]
```

View File

@ -1,5 +1,21 @@
jc changelog
202006xx v1.11.2
- Update netstat parser to add freebsd support
- Update netstat parser to add route_flags_pretty field
- Update netstat parser to change osx_inode field name to unix_inode
- Update netstat parser to change osx_flags field name to unix_flags
- Update netstat parser to strip whitespace from state field
- Update route parser to add flags_pretty field
- Update arp parser to add permanent field (freebsd and osx)
- Update arp parser to add expires field (freebsd)
- Update w parser to strip whitespace from what field
- Update last parser to fix FreeBSD issues
- Update stat parser to change osx_flags field name to unix_flags
- Update stat parser to add osx_device field for freebsd and osx
- Fix freebsd compatibility message for df, fstab, mount, ntpq, stat, and uname parsers
- Fix compatibility message for platforms that include the version number at the end (e.g. freebsd12)
20200523 v1.11.1
- Update stat command parser to change osx_flags field to string

View File

@ -59,6 +59,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f0:98:26",
"iface": "ens33"
"permanent": false,
"expires": 1182
},
{
"name": "gateway",
@ -66,6 +68,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": 110
}
]
@ -77,6 +81,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:fe:7a:b4",
"iface": "ens33"
"permanent": false,
"expires": "1182"
},
{
"name": "_gateway",
@ -84,6 +90,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": "110"
}
]
@ -114,7 +122,9 @@ Returns:
"hwtype": string,
"hwaddress": string,
"flags_mask": string,
"iface": string
"iface": string,
"permanent": boolean,
"expires": integer
}
]

View File

@ -7,7 +7,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:

View File

@ -7,7 +7,7 @@ Usage:
Compatibility:
'linux'
'linux', 'freebsd'
Examples:

View File

@ -7,7 +7,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Example:

View File

@ -12,7 +12,7 @@ Caveats:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:
@ -257,73 +257,100 @@ Returns:
[
{
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": 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,
"destination": string,
"gateway": string,
"route_flags": string,
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, - = null
"ierrs": integer, - = null
"opkts": integer, - = null
"oerrs": integer, - = null
"coll": integer, - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": string,
"kind": string,
"address": string,
"unix_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"unix_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer,
"destination": string,
"gateway": string,
"route_flags": string,
"route_flags_pretty": [
string,
]
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, - = null
"ierrs": integer, - = null
"idrop": integer, - = null
"opkts": integer, - = null
"oerrs": integer, - = null
"coll": integer, - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string,
"ibytes": integer,
"obytes": integer,
"r_mbuf": integer,
"s_mbuf": integer,
"r_clus": integer,
"s_clus": integer,
"r_hiwa": integer,
"s_hiwa": integer,
"r_lowa": integer,
"s_lowa": integer,
"r_bcnt": integer,
"s_bcnt": integer,
"r_bmax": integer,
"s_bmax": integer,
"rexmit": integer,
"ooorcv": integer,
"0_win": integer,
"rexmt": float,
"persist": float,
"keep": float,
"2msl": float,
"delack": float,
"rcvtime": float,
}
]

View File

@ -7,7 +7,7 @@ Usage:
Compatibility:
'linux'
'linux', 'freebsd'
Examples:

View File

@ -119,17 +119,20 @@ Returns:
[
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"flags_pretty": [
string,
]
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
}
]

View File

@ -7,7 +7,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:

View File

@ -11,7 +11,7 @@ Limitations:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Example:

View File

@ -17,7 +17,7 @@ import jc.utils
class info():
version = '1.11.1'
version = '1.11.2'
description = 'jc cli output JSON conversion tool'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'

View File

@ -58,6 +58,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f0:98:26",
"iface": "ens33"
"permanent": false,
"expires": 1182
},
{
"name": "gateway",
@ -65,6 +67,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": 110
}
]
@ -76,6 +80,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:fe:7a:b4",
"iface": "ens33"
"permanent": false,
"expires": "1182"
},
{
"name": "_gateway",
@ -83,6 +89,8 @@ Examples:
"hwtype": "ether",
"hwaddress": "00:50:56:f7:4a:fc",
"iface": "ens33"
"permanent": false,
"expires": "110"
}
]
"""
@ -91,7 +99,7 @@ import jc.parsers.universal
class info():
version = '1.3'
version = '1.4'
description = 'arp command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -123,7 +131,9 @@ def process(proc_data):
"hwtype": string,
"hwaddress": string,
"flags_mask": string,
"iface": string
"iface": string,
"permanent": boolean,
"expires": integer
}
]
"""
@ -133,6 +143,14 @@ def process(proc_data):
if 'name' in entry and entry['name'] == '?':
entry['name'] = None
int_list = ['expires']
for key in int_list:
if key in entry:
try:
entry[key] = int(entry[key])
except (ValueError):
entry[key] = None
return proc_data
@ -159,7 +177,7 @@ def parse(data, raw=False, quiet=False):
if cleandata[-1].startswith('Entries:'):
cleandata.pop(-1)
# detect if osx style was used
# detect if freebsd/osx style was used
if cleandata[0][-1] == ']':
raw_output = []
for line in cleandata:
@ -171,6 +189,15 @@ def parse(data, raw=False, quiet=False):
'hwaddress': splitline[3],
'iface': splitline[5]
}
if 'permanent' in splitline:
output_line['permanent'] = True
else:
output_line['permanent'] = False
if 'expires' in splitline:
output_line['expires'] = splitline[-3]
raw_output.append(output_line)
if raw:

View File

@ -6,7 +6,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:
@ -73,13 +73,13 @@ import jc.parsers.universal
class info():
version = '1.2'
version = '1.3'
description = 'df command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin']
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['df']

View File

@ -6,7 +6,7 @@ Usage:
Compatibility:
'linux'
'linux', 'freebsd'
Examples:
@ -70,13 +70,13 @@ import jc.utils
class info():
version = '1.1'
version = '1.2'
description = 'fstab file parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux']
compatible = ['linux', 'freebsd']
__version__ = info.version

View File

@ -72,7 +72,7 @@ import jc.utils
class info():
version = '1.1'
version = '1.2'
description = 'last and lastb command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -110,6 +110,9 @@ def process(proc_data):
]
"""
for entry in proc_data:
if 'user' in entry and entry['user'] == 'boot_time':
entry['user'] = 'boot time'
if 'tty' in entry and entry['tty'] == '~':
entry['tty'] = None
@ -155,10 +158,11 @@ def parse(data, raw=False, quiet=False):
for entry in cleandata:
output_line = {}
if entry.startswith('wtmp begins ') or entry.startswith('btmp begins '):
if entry.startswith('wtmp begins ') or entry.startswith('btmp begins ') or entry.startswith('utx.log begins '):
continue
entry = entry.replace('system boot', 'system_boot')
entry = entry.replace('boot time', 'boot_time')
entry = entry.replace(' still logged in', '- still_logged_in')
entry = entry.replace(' gone - no logout', '- gone_-_no_logout')
@ -166,6 +170,11 @@ def parse(data, raw=False, quiet=False):
if re.match(r'[MTWFS][ouerha][nedritnu] [JFMASOND][aepuco][nbrynlgptvc]', ' '.join(linedata[2:4])):
linedata.insert(2, '-')
# freebsd fix
if linedata[0] == 'boot_time':
linedata.insert(1, '-')
linedata.insert(1, '~')
output_line['user'] = linedata[0]
output_line['tty'] = linedata[1]
output_line['hostname'] = linedata[2]

View File

@ -6,7 +6,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Example:
@ -56,13 +56,13 @@ import jc.utils
class info():
version = '1.2'
version = '1.3'
description = 'mount command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin']
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['mount']

View File

@ -11,7 +11,7 @@ Caveats:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:
@ -237,13 +237,13 @@ Examples:
class info():
version = '1.5'
version = '1.6'
description = 'netstat command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin']
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['netstat']
@ -264,73 +264,100 @@ def process(proc_data):
[
{
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": 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,
"destination": string,
"gateway": string,
"route_flags": string,
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, - = null
"ierrs": integer, - = null
"opkts": integer, - = null
"oerrs": integer, - = null
"coll": integer, - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string
"proto": string,
"recv_q": integer,
"send_q": integer,
"transport_protocol" string,
"network_protocol": string,
"local_address": string,
"local_port": string,
"local_port_num": integer,
"foreign_address": string,
"foreign_port": string,
"foreign_port_num": integer,
"state": string,
"program_name": string,
"pid": integer,
"user": string,
"security_context": string,
"refcnt": integer,
"flags": string,
"type": string,
"inode": integer,
"path": string,
"kind": string,
"address": string,
"unix_inode": string,
"conn": string,
"refs": string,
"nextref": string,
"name": string,
"unit": integer,
"vendor": integer,
"class": integer,
"subcla": integer,
"unix_flags": integer,
"pcbcount": integer,
"rcvbuf": integer,
"sndbuf": integer,
"rxbytes": integer,
"txbytes": integer,
"destination": string,
"gateway": string,
"route_flags": string,
"route_flags_pretty": [
string,
]
"route_refs": integer,
"use": integer,
"mtu": integer,
"expire": string,
"genmask": string,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string,
"metric": integer,
"network": string,
"address": string,
"ipkts": integer, - = null
"ierrs": integer, - = null
"idrop": integer, - = null
"opkts": integer, - = null
"oerrs": integer, - = null
"coll": integer, - = null
"rx_ok": integer,
"rx_err": integer,
"rx_drp": integer,
"rx_ovr": integer,
"tx_ok": integer,
"tx_err": integer,
"tx_drp": integer,
"tx_ovr": integer,
"flg": string,
"ibytes": integer,
"obytes": integer,
"r_mbuf": integer,
"s_mbuf": integer,
"r_clus": integer,
"s_clus": integer,
"r_hiwa": integer,
"s_hiwa": integer,
"r_lowa": integer,
"s_lowa": integer,
"r_bcnt": integer,
"s_bcnt": integer,
"r_bmax": integer,
"s_bmax": integer,
"rexmit": integer,
"ooorcv": integer,
"0_win": integer,
"rexmt": float,
"persist": float,
"keep": float,
"2msl": float,
"delack": float,
"rcvtime": float,
}
]
"""
@ -340,7 +367,9 @@ def process(proc_data):
'osx_flags', 'subcla', 'pcbcount', 'rcvbuf', 'sndbuf', 'rxbytes', 'txbytes',
'route_refs', 'use', 'mtu', 'mss', 'window', 'irtt', 'metric', 'ipkts',
'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', 'ibytes', 'obytes', 'r_mbuf',
's_mbuf', 'r_clus', 's_clus', 'r_hiwa', 's_hiwa', 'r_lowa', 's_lowa', 'r_bcnt',
's_bcnt', 'r_bmax', 's_bmax', 'rexmit', 'ooorcv', '0_win']
for key in int_list:
if key in entry:
try:
@ -349,6 +378,16 @@ def process(proc_data):
except (ValueError):
entry[key] = None
# float changes
float_list = ['rexmt', 'persist', 'keep', '2msl', 'delack', 'rcvtime']
for key in float_list:
if key in entry:
try:
key_float = float(entry[key])
entry[key] = key_float
except (ValueError):
entry[key] = None
if 'local_port' in entry:
try:
entry['local_port_num'] = int(entry['local_port'])
@ -386,8 +425,8 @@ def parse(data, raw=False, quiet=False):
cleandata = list(filter(None, cleandata))
raw_output = []
# check for OSX vs Linux
# is this from OSX?
# check for FreeBSD/OSX vs Linux
# is this from FreeBSD/OSX?
if cleandata[0] == 'Active Internet connections' \
or cleandata[0] == 'Active Internet connections (including servers)' \
or cleandata[0] == 'Active Multipath Internet connections' \
@ -396,9 +435,10 @@ def parse(data, raw=False, quiet=False):
or cleandata[0] == 'Active kernel event sockets' \
or cleandata[0] == 'Active kernel control sockets' \
or cleandata[0] == 'Routing tables' \
or cleandata[0] == 'Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll':
import jc.parsers.netstat_osx
raw_output = jc.parsers.netstat_osx.parse(cleandata)
or cleandata[0].startswith('Name '):
import jc.parsers.netstat_freebsd_osx
raw_output = jc.parsers.netstat_freebsd_osx.parse(cleandata)
# use linux parser
else:

View File

@ -1,4 +1,4 @@
"""jc - JSON CLI output utility OSX netstat Parser"""
"""jc - JSON CLI output utility FreeBSD and OSX netstat Parser"""
def normalize_headers(header):
@ -6,8 +6,8 @@ def normalize_headers(header):
header = header.replace('local address', 'local_address')
header = header.replace('foreign address', 'foreign_address')
header = header.replace('(state)', 'state')
header = header.replace('inode', 'osx_inode')
header = header.replace('flags', 'osx_flags')
header = header.replace('inode', 'unix_inode')
header = header.replace('flags', 'unix_flags')
header = header.replace('-', '_')
return header
@ -37,9 +37,16 @@ def parse_item(headers, entry, kind):
# fixup udp records with no state field entry
if kind == 'network' and entry[0].startswith('udp'):
entry.insert(5, None)
if kind == 'network' and 'socket' in headers and 'udp' in str(entry):
entry.insert(7, None)
# fixup -T output on FreeBSD
if kind == 'network' and '0_win' in headers and entry[0].startswith('udp'):
entry.insert(1, '')
entry.insert(1, '')
entry.insert(1, '')
# fixup interface records with no address field entry
if kind == 'interface' and len(entry) == 8:
entry.insert(3, None)
@ -86,6 +93,46 @@ def parse_post(raw_data):
else:
entry['network_protocol'] = 'ipv4'
# add route_flags_pretty field
if 'route_flags' in entry:
flag_map = {
'1': 'PROTO1',
'2': 'PROTO2',
'3': 'PROTO3',
'B': 'BLACKHOLE',
'b': 'BROADCAST',
'C': 'CLONING',
'c': 'PRCLONING',
'D': 'DYNAMIC',
'G': 'GATEWAY',
'H': 'HOST',
'I': 'IFSCOPE',
'i': 'IFREF',
'L': 'LLINFO',
'M': 'MODIFIED',
'm': 'MULTICAST',
'R': 'REJECT',
'r': 'ROUTER',
'S': 'STATIC',
'U': 'UP',
'W': 'WASCLONED',
'X': 'XRESOLVE',
'Y': 'PROXY',
}
pretty_flags = []
for flag in entry['route_flags']:
if flag in flag_map:
pretty_flags.append(flag_map[flag])
entry['route_flags_pretty'] = pretty_flags
# strip whitespace from beginning and end of all string values
for item in entry:
if isinstance(entry[item], str):
entry[item] = entry[item].strip()
return raw_data
@ -135,7 +182,7 @@ def parse(cleandata):
interface_table = False
continue
if line.startswith('Active LOCAL (UNIX) domain sockets'):
if line.startswith('Active LOCAL (UNIX) domain sockets') or line.startswith('Active UNIX domain sockets'):
network = False
multipath = False
socket = True
@ -190,7 +237,7 @@ def parse(cleandata):
interface_table = False
continue
if line.startswith('Name Mtu '):
if line.startswith('Name '):
network = False
multipath = False
socket = False
@ -202,7 +249,7 @@ def parse(cleandata):
# don't continue since there is no real header row for this table
# get headers
if network and (line.startswith('Socket ') or line.startswith('Proto ')):
if network and (line.startswith('Socket ') or line.startswith('Proto ') or line.startswith('Tcpcb ')):
header_text = normalize_headers(line)
headers = header_text.split()
continue
@ -232,7 +279,7 @@ def parse(cleandata):
headers = header_text.split()
continue
if interface_table and line.startswith('Name Mtu '):
if interface_table and line.startswith('Name '):
header_text = normalize_interface_headers(line)
headers = header_text.split()
continue

View File

@ -152,6 +152,29 @@ def parse_post(raw_data):
else:
entry['network_protocol'] = 'ipv4'
# add route_flags_pretty
# Flag mapping from https://www.man7.org/linux/man-pages/man8/route.8.html
if 'route_flags' in entry:
flag_map = {
'U': 'UP',
'H': 'HOST',
'G': 'GATEWAY',
'R': 'REINSTATE',
'D': 'DYNAMIC',
'M': 'MODIFIED',
'A': 'ADDRCONF',
'C': 'CACHE',
'!': 'REJECT'
}
pretty_flags = []
for flag in entry['route_flags']:
if flag in flag_map:
pretty_flags.append(flag_map[flag])
entry['route_flags_pretty'] = pretty_flags
return raw_data

View File

@ -6,7 +6,7 @@ Usage:
Compatibility:
'linux'
'linux', 'freebsd'
Examples:
@ -183,13 +183,13 @@ import jc.parsers.universal
class info():
version = '1.0'
version = '1.1'
description = 'ntpq -p command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux']
compatible = ['linux', 'freebsd']
magic_commands = ['ntpq']

View File

@ -101,7 +101,7 @@ import jc.parsers.universal
class info():
version = '1.0'
version = '1.1'
description = 'route command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -128,17 +128,20 @@ def process(proc_data):
[
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"flags_pretty": [
string,
]
"metric": integer,
"ref": integer,
"use": integer,
"mss": integer,
"window": integer,
"irtt": integer,
"iface": string
}
]
"""
@ -152,6 +155,29 @@ def process(proc_data):
except (ValueError):
entry[key] = None
# add flags_pretty
# Flag mapping from https://www.man7.org/linux/man-pages/man8/route.8.html
if 'flags' in entry:
flag_map = {
'U': 'UP',
'H': 'HOST',
'G': 'GATEWAY',
'R': 'REINSTATE',
'D': 'DYNAMIC',
'M': 'MODIFIED',
'A': 'ADDRCONF',
'C': 'CACHE',
'!': 'REJECT'
}
pretty_flags = []
for flag in entry['flags']:
if flag in flag_map:
pretty_flags.append(flag_map[flag])
entry['flags_pretty'] = pretty_flags
return proc_data

View File

@ -6,7 +6,7 @@ Usage:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Examples:
@ -105,13 +105,13 @@ import jc.utils
class info():
version = '1.3'
version = '1.4'
description = 'stat command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin']
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['stat']
@ -151,15 +151,15 @@ def process(proc_data):
"modify_time": string, # - = null
"change_time": string, # - = null
"birth_time": string, # - = null
"osx_device": integer,
"unix_device": integer,
"rdev": integer,
"block_size": integer,
"osx_flags": string
"unix_flags": string
}
]
"""
for entry in proc_data:
int_list = ['size', 'blocks', 'io_blocks', 'inode', 'links', 'uid', 'gid', 'osx_device', 'rdev', 'block_size']
int_list = ['size', 'blocks', 'io_blocks', 'inode', 'links', 'uid', 'gid', 'unix_device', 'rdev', 'block_size']
for key in int_list:
if key in entry:
try:
@ -282,13 +282,13 @@ def parse(data, raw=False, quiet=False):
raw_output.append(output_line)
continue
# OSX output
# FreeBSD/OSX output
else:
for line in cleandata:
value = shlex.split(line)
output_line = {
'file': value[15],
'device': value[0],
'unix_device': value[0],
'inode': value[1],
'flags': value[2],
'links': value[3],
@ -302,7 +302,7 @@ def parse(data, raw=False, quiet=False):
'birth_time': value[11],
'block_size': value[12],
'blocks': value[13],
'osx_flags': value[14]
'unix_flags': value[14]
}
raw_output.append(output_line)

View File

@ -10,7 +10,7 @@ Limitations:
Compatibility:
'linux', 'darwin'
'linux', 'darwin', 'freebsd'
Example:
@ -30,13 +30,13 @@ import jc.utils
class info():
version = '1.1'
version = '1.2'
description = 'uname -a command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
# compatible options: linux, darwin, cygwin, win32, aix, freebsd
compatible = ['linux', 'darwin']
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['uname']

View File

@ -83,7 +83,7 @@ import jc.utils
class info():
version = '1.0'
version = '1.1'
description = 'w command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
@ -174,6 +174,12 @@ def parse(data, raw=False, quiet=False):
output_line = dict(zip(headers, temp_line))
raw_output.append(output_line)
# strip whitespace from beginning and end of all string values
for row in raw_output:
for item in row:
if isinstance(row[item], str):
row[item] = row[item].strip()
if raw:
return raw_output
else:

View File

@ -56,7 +56,14 @@ def compatibility(mod_name, compatible):
no return, just prints output to STDERR
"""
if sys.platform not in compatible:
platform_found = False
for platform in compatible:
if sys.platform.startswith(platform):
platform_found = True
break
if not platform_found:
mod = mod_name.split('.')[-1]
compat_list = ', '.join(compatible)
warning_message(f'{mod} parser not compatible with your OS ({sys.platform}).\n Compatible platforms: {compat_list}')

View File

@ -1 +1 @@
[{"destination": "default", "gateway": "gateway", "genmask": "0.0.0.0", "route_flags": "UG", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route"}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "docker0", "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route"}]
[{"destination": "default", "gateway": "gateway", "genmask": "0.0.0.0", "route_flags": "UG", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "docker0", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route"}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "docker0", "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "docker0", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "docker", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "docker", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "docker0"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "GATEWAY"]}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "docker0", "flags_pretty": ["UP"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP"]}]

View File

@ -1 +1 @@
[{"destination": "default", "gateway": "gateway", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "docker0"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}]
[{"destination": "default", "gateway": "gateway", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "GATEWAY"]}, {"destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "docker0", "flags_pretty": ["UP"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP"]}]

1
tests/fixtures/freebsd12/arp-a.json vendored Normal file
View File

@ -0,0 +1 @@
[{"name": null, "address": "192.168.71.163", "hwtype": "ethernet", "hwaddress": "00:0c:29:1a:4e:3b", "iface": "em0", "permanent": true}, {"name": null, "address": "192.168.71.2", "hwtype": "ethernet", "hwaddress": "00:50:56:f7:4a:fc", "iface": "em0", "permanent": false, "expires": 942}, {"name": null, "address": "192.168.71.1", "hwtype": "ethernet", "hwaddress": "00:50:56:c0:00:08", "iface": "em0", "permanent": false, "expires": 1182}]

3
tests/fixtures/freebsd12/arp-a.out vendored Normal file
View File

@ -0,0 +1,3 @@
? (192.168.71.163) at 00:0c:29:1a:4e:3b on em0 permanent [ethernet]
? (192.168.71.2) at 00:50:56:f7:4a:fc on em0 expires in 942 seconds [ethernet]
? (192.168.71.1) at 00:50:56:c0:00:08 on em0 expires in 1182 seconds [ethernet]

1
tests/fixtures/freebsd12/last.json vendored Normal file
View File

@ -0,0 +1 @@
[{"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Thu May 28 21:29", "logout": "still logged in"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Thu May 28 04:13", "logout": "21:29", "duration": "17:16"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Wed May 27 16:09", "logout": "04:13", "duration": "12:03"}, {"user": "root", "tty": "ttyv0", "hostname": null, "login": "Wed May 27 12:48", "logout": "still logged in"}, {"user": "kbrazil", "tty": "pts/0", "hostname": "192.168.71.1", "login": "Wed May 27 12:47", "logout": "16:09", "duration": "03:22"}, {"user": "kbrazil", "tty": "ttyv0", "hostname": null, "login": "Wed May 27 12:46", "logout": "12:48", "duration": "00:01"}, {"user": "boot time", "tty": null, "hostname": null, "login": "Wed May 27 12:46"}]

9
tests/fixtures/freebsd12/last.out vendored Normal file
View File

@ -0,0 +1,9 @@
kbrazil pts/0 192.168.71.1 Thu May 28 21:29 still logged in
kbrazil pts/0 192.168.71.1 Thu May 28 04:13 - 21:29 (17:16)
kbrazil pts/0 192.168.71.1 Wed May 27 16:09 - 04:13 (12:03)
root ttyv0 Wed May 27 12:48 still logged in
kbrazil pts/0 192.168.71.1 Wed May 27 12:47 - 16:09 (03:22)
kbrazil ttyv0 Wed May 27 12:46 - 12:48 (00:01)
boot time Wed May 27 12:46
utx.log begins Wed May 27 12:46:05 PDT 2020

View File

@ -0,0 +1 @@
[{"tcpcb": "fffff80003df43d0", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "192.168.71.1", "foreign_address": "192.168.71.1", "state": "ESTABLISHED", "kind": "network", "local_port": "ssh", "foreign_port": "56321", "transport_protocol": "tcp", "network_protocol": "ipv4", "foreign_port_num": 56321}, {"tcpcb": "fffff80003df47a0", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "localhost", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "smtp", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003df4b70", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003df0000", "proto": "tcp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv6"}, {"tcpcb": "fffff80003ae81e8", "proto": "udp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "syslog", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003ae87a0", "proto": "udp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "syslog", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv6"}, {"address": "fffff80003ab6100", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6200", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6200", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6100", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6300", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "0", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6800", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6900", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6900", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6800", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003abf000", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c581e0", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.pipe", "kind": "socket"}, {"address": "fffff80003ac3e00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6400", "kind": "socket"}, {"address": "fffff80003ab6400", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6000", "kind": "socket"}, {"address": "fffff80003ab6000", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6600", "kind": "socket"}, {"address": "fffff80003ab6500", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6d00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6600", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6c00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c59d20", "conn": "0", "refs": "fffff80003ac3e00", "nextref": "0", "addr": "/var/run/logpriv", "kind": "socket"}, {"address": "fffff80003ab6d00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c67000", "conn": "0", "refs": "fffff80003ab6500", "nextref": "0", "addr": "/var/run/log", "kind": "socket"}, {"address": "fffff80003ab6e00", "type": "seqpac", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c58000", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.seqpacket.pipe", "kind": "socket"}]

24
tests/fixtures/freebsd12/netstat-Aa.out vendored Normal file
View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Tcpcb Proto Recv-Q Send-Q Local Address Foreign Address (state)
fffff80003df43d0 tcp4 0 0 192.168.71.1.ssh 192.168.71.1.56321 ESTABLISHED
fffff80003df47a0 tcp4 0 0 localhost.smtp *.* LISTEN
fffff80003df4b70 tcp4 0 0 *.ssh *.* LISTEN
fffff80003df0000 tcp6 0 0 *.ssh *.* LISTEN
fffff80003ae81e8 udp4 0 0 *.syslog *.*
fffff80003ae87a0 udp6 0 0 *.syslog *.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

View File

@ -0,0 +1 @@
[{"tcpcb": "fffff80003df43d0", "proto": "tcp4", "rexmit": 3, "ooorcv": 0, "0_win": 0, "local_address": "192.168.71.1", "foreign_address": "192.168.71.1", "kind": "network", "local_port": "ssh", "foreign_port": "64330", "transport_protocol": "tcp", "network_protocol": "ipv4", "foreign_port_num": 64330}, {"tcpcb": "fffff80003df47a0", "proto": "tcp4", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "localhost", "foreign_address": "*", "kind": "network", "local_port": "smtp", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003df4b70", "proto": "tcp4", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003df0000", "proto": "tcp6", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv6"}, {"tcpcb": "fffff80003ae81e8", "proto": "udp4", "rexmit": null, "ooorcv": null, "kind": "network", "transport_protocol": "udp", "network_protocol": "ipv4"}, {"tcpcb": "fffff80003ae87a0", "proto": "udp6", "rexmit": null, "ooorcv": null, "kind": "network", "transport_protocol": "udp", "network_protocol": "ipv6"}, {"address": "fffff80003ab6200", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6100", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6100", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6200", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6300", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "0", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6800", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6900", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6900", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6800", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003abf000", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c581e0", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.pipe", "kind": "socket"}, {"address": "fffff80003ac3e00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6400", "kind": "socket"}, {"address": "fffff80003ab6400", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6000", "kind": "socket"}, {"address": "fffff80003ab6000", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6600", "kind": "socket"}, {"address": "fffff80003ab6500", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6d00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6600", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6c00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c59d20", "conn": "0", "refs": "fffff80003ac3e00", "nextref": "0", "addr": "/var/run/logpriv", "kind": "socket"}, {"address": "fffff80003ab6d00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c67000", "conn": "0", "refs": "fffff80003ab6500", "nextref": "0", "addr": "/var/run/log", "kind": "socket"}, {"address": "fffff80003ab6e00", "type": "seqpac", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c58000", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.seqpacket.pipe", "kind": "socket"}]

View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Tcpcb Proto Rexmit OOORcv 0-win Local Address Foreign Address
fffff80003df43d0 tcp4 3 0 0 192.168.71.1.ssh 192.168.71.1.64330
fffff80003df47a0 tcp4 0 0 0 localhost.smtp *.*
fffff80003df4b70 tcp4 0 0 0 *.ssh *.*
fffff80003df0000 tcp6 0 0 0 *.ssh *.*
fffff80003ae81e8 udp4 *.syslog *.*
fffff80003ae87a0 udp6 *.syslog *.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

View File

@ -0,0 +1 @@
[{"tcpcb": "fffff80003df43d0", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "192.168.71.163", "foreign_address": "192.168.71.1", "state": "ESTABLISHED", "log": "-", "kind": "network", "local_port": "22", "foreign_port": "64330", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 22, "foreign_port_num": 64330}, {"tcpcb": "fffff80003df47a0", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "127.0.0.1", "foreign_address": "*", "state": "LISTEN", "log": "-", "kind": "network", "local_port": "25", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 25}, {"tcpcb": "fffff80003df4b70", "proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "log": "-", "kind": "network", "local_port": "22", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 22}, {"tcpcb": "fffff80003df0000", "proto": "tcp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "log": "-", "kind": "network", "local_port": "22", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv6", "local_port_num": 22}, {"tcpcb": "fffff80003ae81e8", "proto": "udp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "514", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv4", "local_port_num": 514}, {"tcpcb": "fffff80003ae87a0", "proto": "udp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "514", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv6", "local_port_num": 514}, {"address": "fffff80003ab6200", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6100", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6100", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6200", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6300", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "0", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6800", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6900", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6900", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6800", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003abf000", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c581e0", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.pipe", "kind": "socket"}, {"address": "fffff80003ac3e00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6400", "kind": "socket"}, {"address": "fffff80003ab6400", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6000", "kind": "socket"}, {"address": "fffff80003ab6000", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6600", "kind": "socket"}, {"address": "fffff80003ab6500", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6d00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6600", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6c00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c59d20", "conn": "0", "refs": "fffff80003ac3e00", "nextref": "0", "addr": "/var/run/logpriv", "kind": "socket"}, {"address": "fffff80003ab6d00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c67000", "conn": "0", "refs": "fffff80003ab6500", "nextref": "0", "addr": "/var/run/log", "kind": "socket"}, {"address": "fffff80003ab6e00", "type": "seqpac", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c58000", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.seqpacket.pipe", "kind": "socket"}]

View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Tcpcb Proto Recv-Q Send-Q Local Address Foreign Address (state) Log ID
fffff80003df43d0 tcp4 0 0 192.168.71.163.22 192.168.71.1.64330 ESTABLISHED -
fffff80003df47a0 tcp4 0 0 127.0.0.1.25 *.* LISTEN -
fffff80003df4b70 tcp4 0 0 *.22 *.* LISTEN -
fffff80003df0000 tcp6 0 0 *.22 *.* LISTEN -
fffff80003ae81e8 udp4 0 0 *.514 *.*
fffff80003ae87a0 udp6 0 0 *.514 *.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Tcpcb Proto Recv-Q Send-Q Local Address Foreign Address R-MBUF S-MBUF R-CLUS S-CLUS R-HIWA S-HIWA R-LOWA S-LOWA R-BCNT S-BCNT R-BMAX S-BMAX rexmt persist keep 2msl delack rcvtime
fffff80003df43d0 tcp4 0 0 192.168.71.1.ssh 192.168.71.1.64330 0 0 0 0 65700 33580 1 2048 0 0 525600 268640 0.00 0.00 5079.93 0.00 0.00 0.00
fffff80003df47a0 tcp4 0 0 localhost.smtp *.* 0 0 0 0 0 0 0 0 0 0 0 0 0.00 0.00 0.00 0.00 0.00 8841.63
fffff80003df4b70 tcp4 0 0 *.ssh *.* 0 0 0 0 0 0 0 0 0 0 0 0 0.00 0.00 0.00 0.00 0.00 8857.24
fffff80003df0000 tcp6 0 0 *.ssh *.* 0 0 0 0 0 0 0 0 0 0 0 0 0.00 0.00 0.00 0.00 0.00 8857.24
fffff80003ae81e8 udp4 0 0 *.syslog *.* 0 0 0 0 0 9216 0 2048 0 0 0 73728
fffff80003ae87a0 udp6 0 0 *.syslog *.* 0 0 0 0 0 9216 0 2048 0 0 0 73728
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

View File

@ -0,0 +1 @@
[{"proto": "tcp4", "rexmit": 3, "ooorcv": 0, "0_win": 0, "local_address": "192.168.71.163", "foreign_address": "192.168.71.1", "kind": "network", "local_port": "ssh", "foreign_port": "64330", "transport_protocol": "tcp", "network_protocol": "ipv4", "foreign_port_num": 64330}, {"proto": "tcp4", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "localhost", "foreign_address": "*", "kind": "network", "local_port": "smtp", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"proto": "tcp4", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4"}, {"proto": "tcp6", "rexmit": 0, "ooorcv": 0, "0_win": 0, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "ssh", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv6"}, {"proto": "udp4", "rexmit": null, "ooorcv": null, "0_win": null, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "syslog", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv4"}, {"proto": "udp6", "rexmit": null, "ooorcv": null, "0_win": null, "local_address": "*", "foreign_address": "*", "kind": "network", "local_port": "syslog", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv6"}, {"address": "fffff80003ab6200", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6100", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6100", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6200", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6300", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "0", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6800", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6900", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6900", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6800", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003abf000", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c581e0", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.pipe", "kind": "socket"}, {"address": "fffff80003ac3e00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6400", "kind": "socket"}, {"address": "fffff80003ab6400", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6000", "kind": "socket"}, {"address": "fffff80003ab6000", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6600", "kind": "socket"}, {"address": "fffff80003ab6500", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6d00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6600", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6c00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c59d20", "conn": "0", "refs": "fffff80003ac3e00", "nextref": "0", "addr": "/var/run/logpriv", "kind": "socket"}, {"address": "fffff80003ab6d00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c67000", "conn": "0", "refs": "fffff80003ab6500", "nextref": "0", "addr": "/var/run/log", "kind": "socket"}, {"address": "fffff80003ab6e00", "type": "seqpac", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c58000", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.seqpacket.pipe", "kind": "socket"}]

24
tests/fixtures/freebsd12/netstat-aT.out vendored Normal file
View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Proto Rexmit OOORcv 0-win Local Address Foreign Address
tcp4 3 0 0 192.168.71.163.ssh 192.168.71.1.64330
tcp4 0 0 0 localhost.smtp *.*
tcp4 0 0 0 *.ssh *.*
tcp6 0 0 0 *.ssh *.*
udp4 *.syslog *.*
udp6 *.syslog *.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

View File

@ -0,0 +1 @@
[{"proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "192.168.71.163", "foreign_address": "192.168.71.1", "state": "ESTABLISHED", "kind": "network", "local_port": "22", "foreign_port": "56321", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 22, "foreign_port_num": 56321}, {"proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "127.0.0.1", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "25", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 25}, {"proto": "tcp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "22", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv4", "local_port_num": 22}, {"proto": "tcp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": "LISTEN", "kind": "network", "local_port": "22", "foreign_port": "*", "transport_protocol": "tcp", "network_protocol": "ipv6", "local_port_num": 22}, {"proto": "udp4", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": null, "kind": "network", "local_port": "514", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv4", "local_port_num": 514}, {"proto": "udp6", "recv_q": 0, "send_q": 0, "local_address": "*", "foreign_address": "*", "state": null, "kind": "network", "local_port": "514", "foreign_port": "*", "transport_protocol": "udp", "network_protocol": "ipv6", "local_port_num": 514}, {"address": "fffff80003ab6100", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6200", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6200", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6100", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6300", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "0", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6800", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6900", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6900", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6800", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003abf000", "type": "stream", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c581e0", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.pipe", "kind": "socket"}, {"address": "fffff80003ac3e00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6400", "kind": "socket"}, {"address": "fffff80003ab6400", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6000", "kind": "socket"}, {"address": "fffff80003ab6000", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "fffff80003ab6600", "kind": "socket"}, {"address": "fffff80003ab6500", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6d00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6600", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "0", "conn": "fffff80003ab6c00", "refs": "0", "nextref": "0", "kind": "socket"}, {"address": "fffff80003ab6c00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c59d20", "conn": "0", "refs": "fffff80003ac3e00", "nextref": "0", "addr": "/var/run/logpriv", "kind": "socket"}, {"address": "fffff80003ab6d00", "type": "dgram", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c67000", "conn": "0", "refs": "fffff80003ab6500", "nextref": "0", "addr": "/var/run/log", "kind": "socket"}, {"address": "fffff80003ab6e00", "type": "seqpac", "recv_q": 0, "send_q": 0, "unix_inode": "fffff80003c58000", "conn": "0", "refs": "0", "nextref": "0", "addr": "/var/run/devd.seqpacket.pipe", "kind": "socket"}]

24
tests/fixtures/freebsd12/netstat-an.out vendored Normal file
View File

@ -0,0 +1,24 @@
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 192.168.71.163.22 192.168.71.1.56321 ESTABLISHED
tcp4 0 0 127.0.0.1.25 *.* LISTEN
tcp4 0 0 *.22 *.* LISTEN
tcp6 0 0 *.22 *.* LISTEN
udp4 0 0 *.514 *.*
udp6 0 0 *.514 *.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
fffff80003ab6100 stream 0 0 0 fffff80003ab6200 0 0
fffff80003ab6200 stream 0 0 0 fffff80003ab6100 0 0
fffff80003ab6300 stream 0 0 0 0 0 0
fffff80003ab6800 stream 0 0 0 fffff80003ab6900 0 0
fffff80003ab6900 stream 0 0 0 fffff80003ab6800 0 0
fffff80003abf000 stream 0 0 fffff80003c581e0 0 0 0 /var/run/devd.pipe
fffff80003ac3e00 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6400
fffff80003ab6400 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6000
fffff80003ab6000 dgram 0 0 0 fffff80003ab6c00 0 fffff80003ab6600
fffff80003ab6500 dgram 0 0 0 fffff80003ab6d00 0 0
fffff80003ab6600 dgram 0 0 0 fffff80003ab6c00 0 0
fffff80003ab6c00 dgram 0 0 fffff80003c59d20 0 fffff80003ac3e00 0 /var/run/logpriv
fffff80003ab6d00 dgram 0 0 fffff80003c67000 0 fffff80003ab6500 0 /var/run/log
fffff80003ab6e00 seqpac 0 0 fffff80003c58000 0 0 0 /var/run/devd.seqpacket.pipe

View File

@ -0,0 +1 @@
[{"iface": "em0", "mtu": 1500, "network": "<Link#1>", "address": "00:0c:29:1a:4e:3b", "ipkts": 189449, "ierrs": 0, "idrop": 0, "opkts": 211310, "oerrs": 0, "coll": 0, "kind": "interface"}, {"iface": "em0", "mtu": null, "network": "fe80::%em0/64", "address": "fe80::20c:29ff:fe", "ipkts": 0, "ierrs": null, "idrop": null, "opkts": 4, "oerrs": null, "coll": null, "kind": "interface"}, {"iface": "em0", "mtu": null, "network": "192.168.71.0/", "address": "192.168.71.163", "ipkts": 92481, "ierrs": null, "idrop": null, "opkts": 172946, "oerrs": null, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": 16384, "network": "<Link#2>", "address": "lo0", "ipkts": 26, "ierrs": 0, "idrop": 0, "opkts": 26, "oerrs": 0, "coll": 0, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "localhost", "address": "localhost", "ipkts": 23, "ierrs": null, "idrop": null, "opkts": 23, "oerrs": null, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "fe80::%lo0/64", "address": "fe80::1%lo0", "ipkts": 0, "ierrs": null, "idrop": null, "opkts": 0, "oerrs": null, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "your-net", "address": "localhost", "ipkts": 3, "ierrs": null, "idrop": null, "opkts": 3, "oerrs": null, "coll": null, "kind": "interface"}]

View File

@ -0,0 +1,8 @@
Name Mtu Network Address Ipkts Ierrs Idrop Opkts Oerrs Coll
em0 1500 <Link#1> 00:0c:29:1a:4e:3b 189449 0 0 211310 0 0
em0 - fe80::%em0/64 fe80::20c:29ff:fe 0 - - 4 - -
em0 - 192.168.71.0/ 192.168.71.163 92481 - - 172946 - -
lo0 16384 <Link#2> lo0 26 0 0 26 0 0
lo0 - localhost localhost 23 - - 23 - -
lo0 - fe80::%lo0/64 fe80::1%lo0 0 - - 0 - -
lo0 - your-net localhost 3 - - 3 - -

View File

@ -0,0 +1 @@
[{"iface": "em0", "mtu": 1500, "network": "<Link#1>", "address": "00:0c:29:1a:4e:3b", "ipkts": 372717, "ierrs": 0, "idrop": 0, "ibytes": 372538087, "opkts": 213821, "oerrs": 0, "obytes": 198573339, "coll": 0, "kind": "interface"}, {"iface": "em0", "mtu": null, "network": "fe80::%em0/64", "address": "fe80::20c:29ff:fe", "ipkts": 0, "ierrs": null, "idrop": null, "ibytes": 0, "opkts": 4, "oerrs": null, "obytes": 264, "coll": null, "kind": "interface"}, {"iface": "em0", "mtu": null, "network": "192.168.71.0/", "address": "192.168.71.163", "ipkts": 97396, "ierrs": null, "idrop": null, "ibytes": 68178099, "opkts": 175413, "oerrs": null, "obytes": 193957797, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": 16384, "network": "<Link#2>", "address": "lo0", "ipkts": 98, "ierrs": 0, "idrop": 0, "ibytes": 21024, "opkts": 98, "oerrs": 0, "obytes": 21024, "coll": 0, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "localhost", "address": "localhost", "ipkts": 25, "ierrs": null, "idrop": null, "ibytes": 4829, "opkts": 25, "oerrs": null, "obytes": 4829, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "fe80::%lo0/64", "address": "fe80::1%lo0", "ipkts": 0, "ierrs": null, "idrop": null, "ibytes": 0, "opkts": 0, "oerrs": null, "obytes": 0, "coll": null, "kind": "interface"}, {"iface": "lo0", "mtu": null, "network": "your-net", "address": "localhost", "ipkts": 73, "ierrs": null, "idrop": null, "ibytes": 16195, "opkts": 73, "oerrs": null, "obytes": 16195, "coll": null, "kind": "interface"}]

View File

@ -0,0 +1,8 @@
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
em0 1500 <Link#1> 00:0c:29:1a:4e:3b 372717 0 0 372538087 213821 0 198573339 0
em0 - fe80::%em0/64 fe80::20c:29ff:fe 0 - - 0 4 - 264 -
em0 - 192.168.71.0/ 192.168.71.163 97396 - - 68178099 175413 - 193957797 -
lo0 16384 <Link#2> lo0 98 0 0 21024 98 0 21024 0
lo0 - localhost localhost 25 - - 4829 25 - 4829 -
lo0 - fe80::%lo0/64 fe80::1%lo0 0 - - 0 0 - 0 -
lo0 - your-net localhost 73 - - 16195 73 - 16195 -

View File

@ -0,0 +1 @@
[{"destination": "default", "gateway": "192.168.71.2", "route_flags": "UGS", "iface": "em0", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY", "STATIC"]}, {"destination": "localhost", "gateway": "link#2", "route_flags": "UH", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "HOST"]}, {"destination": "192.168.71.0/24", "gateway": "link#1", "route_flags": "U", "iface": "em0", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.163", "gateway": "link#1", "route_flags": "UHS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "HOST", "STATIC"]}, {"destination": "::/96", "gateway": "localhost", "route_flags": "UGRS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY", "REJECT", "STATIC"]}, {"destination": "localhost", "gateway": "link#2", "route_flags": "UH", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "HOST"]}, {"destination": "::ffff:0.0.0.0/96", "gateway": "localhost", "route_flags": "UGRS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY", "REJECT", "STATIC"]}, {"destination": "fe80::/10", "gateway": "localhost", "route_flags": "UGRS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY", "REJECT", "STATIC"]}, {"destination": "fe80::%em0/64", "gateway": "link#1", "route_flags": "U", "iface": "em0", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "fe80::20c:29ff:fe1", "gateway": "link#1", "route_flags": "UHS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "HOST", "STATIC"]}, {"destination": "fe80::%lo0/64", "gateway": "link#2", "route_flags": "U", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "fe80::1%lo0", "gateway": "link#2", "route_flags": "UHS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "HOST", "STATIC"]}, {"destination": "ff02::/16", "gateway": "localhost", "route_flags": "UGRS", "iface": "lo0", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY", "REJECT", "STATIC"]}]

20
tests/fixtures/freebsd12/netstat-r.out vendored Normal file
View File

@ -0,0 +1,20 @@
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 192.168.71.2 UGS em0
localhost link#2 UH lo0
192.168.71.0/24 link#1 U em0
192.168.71.163 link#1 UHS lo0
Internet6:
Destination Gateway Flags Netif Expire
::/96 localhost UGRS lo0
localhost link#2 UH lo0
::ffff:0.0.0.0/96 localhost UGRS lo0
fe80::/10 localhost UGRS lo0
fe80::%em0/64 link#1 U em0
fe80::20c:29ff:fe1 link#1 UHS lo0
fe80::%lo0/64 link#2 U lo0
fe80::1%lo0 link#2 UHS lo0
ff02::/16 localhost UGRS lo0

1
tests/fixtures/freebsd12/ntpq-p.json vendored Normal file
View File

@ -0,0 +1 @@
[{"remote": "0.freebsd.pool.", "refid": ".POOL.", "st": 16, "t": "p", "when": null, "poll": 64, "reach": 0, "delay": 0.0, "offset": 0.0, "jitter": 0.0, "state": null}, {"remote": "vf1.bbnx.net", "refid": "252.74.143.178", "st": 2, "t": "u", "when": 1, "poll": 64, "reach": 1, "delay": 387.363, "offset": 1589483.0, "jitter": 39.556, "state": null}, {"remote": "time.airgapped.", "refid": "132.163.96.1", "st": 2, "t": "u", "when": 2, "poll": 64, "reach": 1, "delay": 70.572, "offset": 1589483.0, "jitter": 0.724, "state": null}, {"remote": "clock.trit.net", "refid": "43.77.130.254", "st": 2, "t": "u", "when": 2, "poll": 64, "reach": 1, "delay": 55.717, "offset": 1589483.0, "jitter": 2.021, "state": null}, {"remote": "time.nullrouten", "refid": "132.163.97.1", "st": 2, "t": "u", "when": 1, "poll": 64, "reach": 1, "delay": 59.682, "offset": 1589483.0, "jitter": 7.573, "state": null}]

7
tests/fixtures/freebsd12/ntpq-p.out vendored Normal file
View File

@ -0,0 +1,7 @@
remote refid st t when poll reach delay offset jitter
==============================================================================
0.freebsd.pool. .POOL. 16 p - 64 0 0.000 0.000 0.000
vf1.bbnx.net 252.74.143.178 2 u 1 64 1 387.363 1589483 39.556
time.airgapped. 132.163.96.1 2 u 2 64 1 70.572 1589483 0.724
clock.trit.net 43.77.130.254 2 u 2 64 1 55.717 1589483 2.021
time.nullrouten 132.163.97.1 2 u 1 64 1 59.682 1589483 7.573

1
tests/fixtures/freebsd12/stat.json vendored Normal file

File diff suppressed because one or more lines are too long

107
tests/fixtures/freebsd12/stat.out vendored Normal file
View File

@ -0,0 +1,107 @@
93 1685475 drwxr-xr-x 2 root wheel 3370961 512 "May 27 05:40:02 2020" "Oct 31 21:25:13 2019" "May 27 05:40:25 2020" "Oct 31 21:25:13 2019" 32768 8 0 /etc/X11
93 1685419 lrwxr-xr-x 1 root wheel 7596553527777386861 12 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 0 0 /etc/aliases
93 1685412 -rw-r--r-- 1 root wheel 3377398 225 "May 27 05:40:02 2020" "Oct 31 21:31:22 2019" "May 27 05:40:03 2020" "Oct 31 21:31:22 2019" 32768 8 0 /etc/amd.map
93 1685417 -rw-r--r-- 1 root wheel 3377407 373 "May 27 05:40:02 2020" "Oct 31 21:31:24 2019" "May 27 05:40:03 2020" "Oct 31 21:31:24 2019" 32768 8 0 /etc/auto_master
93 1685474 drwxr-xr-x 2 root wheel 3370960 512 "May 27 05:40:02 2020" "Oct 31 21:31:24 2019" "May 27 05:40:25 2020" "Oct 31 21:31:24 2019" 32768 8 0 /etc/autofs
93 1685392 -rw-r--r-- 1 root wheel 3377374 473 "May 27 05:40:02 2020" "Oct 31 21:31:25 2019" "May 27 05:40:03 2020" "Oct 31 21:31:25 2019" 32768 8 0 /etc/blacklistd.conf
93 1685458 drwxr-xr-x 2 root wheel 3370957 512 "May 27 05:40:02 2020" "Oct 31 21:31:25 2019" "May 27 05:40:25 2020" "Oct 31 21:31:25 2019" 32768 8 0 /etc/bluetooth
93 1685408 drwxr-xr-x 2 root wheel 3377394 512 "May 27 05:40:02 2020" "Oct 31 21:30:12 2019" "May 27 05:40:25 2020" "Oct 31 21:30:12 2019" 32768 8 0 /etc/cron.d
93 1685463 -rw-r--r-- 1 root wheel 3377509 731 "May 28 08:31:19 2020" "Oct 31 21:30:54 2019" "May 27 05:40:03 2020" "Oct 31 21:30:54 2019" 32768 8 0 /etc/crontab
93 1685466 -rw-r--r-- 1 root wheel 3377512 116 "May 28 23:00:16 2020" "Oct 31 21:27:28 2019" "May 27 05:40:03 2020" "Oct 31 21:27:28 2019" 32768 8 0 /etc/csh.cshrc
93 1685422 -rw-r--r-- 1 root wheel 3377421 486 "May 27 12:48:15 2020" "Oct 31 21:27:28 2019" "May 27 05:40:03 2020" "Oct 31 21:27:28 2019" 32768 8 0 /etc/csh.login
93 1685385 -rw-r--r-- 1 root wheel 3377351 118 "May 27 05:40:02 2020" "Oct 31 21:27:28 2019" "May 27 05:40:03 2020" "Oct 31 21:27:28 2019" 32768 8 0 /etc/csh.logout
93 1685381 -rw-r--r-- 1 root wheel 3377347 569 "May 27 05:40:02 2020" "Oct 31 21:27:58 2019" "May 27 05:40:03 2020" "Oct 31 21:27:58 2019" 32768 8 0 /etc/ddb.conf
93 1685390 drwxr-xr-x 2 root wheel 3377372 512 "May 27 05:40:02 2020" "Oct 31 21:31:25 2019" "May 27 05:40:25 2020" "Oct 31 21:31:25 2019" 32768 8 0 /etc/defaults
93 1685425 drwxr-xr-x 2 root wheel 3370944 512 "May 27 05:40:02 2020" "Oct 31 21:31:28 2019" "May 27 05:40:25 2020" "Oct 31 21:31:28 2019" 32768 8 0 /etc/devd
93 1685418 -rw-r--r-- 1 root wheel 3377416 10504 "May 27 05:45:37 2020" "Oct 31 21:28:05 2019" "May 27 05:40:03 2020" "Oct 31 21:28:05 2019" 32768 24 0 /etc/devd.conf
93 1685406 -rw-r--r-- 1 root wheel 3377392 1998 "May 27 12:46:05 2020" "Oct 31 21:27:58 2019" "May 27 05:40:03 2020" "Oct 31 21:27:58 2019" 32768 8 0 /etc/devfs.conf
93 1685404 -rw-r--r-- 1 root wheel 3377390 279 "May 27 05:45:37 2020" "Oct 31 21:27:58 2019" "May 27 05:40:03 2020" "Oct 31 21:27:58 2019" 32768 8 0 /etc/dhclient.conf
93 1685430 -rw-r--r-- 1 root wheel 3370950 5909 "May 27 05:40:02 2020" "Oct 31 21:28:05 2019" "May 27 05:40:03 2020" "Oct 31 21:28:05 2019" 32768 16 0 /etc/disktab
93 1685472 drwxr-xr-x 2 root wheel 3377518 512 "May 27 05:40:02 2020" "Oct 31 21:27:17 2019" "May 27 05:40:25 2020" "Oct 31 21:27:17 2019" 32768 8 0 /etc/dma
93 1685433 -rw-rw-r-- 1 root operator 0 0 "May 27 05:40:02 2020" "Oct 31 21:27:59 2019" "May 27 05:40:03 2020" "Oct 31 21:27:59 2019" 32768 0 0 /etc/dumpdates
93 1685434 -rw-r--r-- 1 root wheel 3377430 156 "May 27 12:48:15 2020" "Oct 31 21:29:55 2019" "May 27 05:40:03 2020" "Oct 31 21:29:55 2019" 32768 8 0 /etc/fbtab
93 1685428 -rw-r--r-- 1 root wheel 3370948 2910 "May 27 05:40:02 2020" "Oct 31 21:31:34 2019" "May 27 05:40:03 2020" "Oct 31 21:31:34 2019" 32768 8 0 /etc/freebsd-update.conf
93 1685383 -rw-r--r-- 1 root wheel 3377350 102 "May 28 03:02:18 2020" "May 27 05:44:32 2020" "May 27 05:44:32 2020" "May 27 05:44:32 2020" 32768 8 0 /etc/fstab
93 1685398 -rw-r--r-- 1 root wheel 3377382 292 "May 27 05:40:02 2020" "Oct 31 21:27:20 2019" "May 27 05:40:03 2020" "Oct 31 21:27:20 2019" 32768 8 0 /etc/ftpusers
93 1685399 -rw-r--r-- 1 root wheel 3377384 6201 "May 27 12:48:12 2020" "Oct 31 21:27:17 2019" "May 27 05:40:03 2020" "Oct 31 21:27:17 2019" 32768 16 0 /etc/gettytab
93 1685439 -rw-r--r-- 1 root wheel 3415435 539 "May 28 23:36:49 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" 32768 8 0 /etc/group
93 1685424 drwxr-xr-x 2 root wheel 3377423 512 "May 28 22:08:32 2020" "Oct 31 21:32:27 2019" "May 27 05:40:25 2020" "Oct 31 21:32:27 2019" 32768 8 0 /etc/gss
93 1710162 -rw-r--r-- 1 root wheel 3403621 46 "May 27 05:45:40 2020" "May 27 05:45:40 2020" "May 27 05:45:40 2020" "May 27 05:45:40 2020" 32768 8 0 /etc/host.conf
93 1710160 -rw-r--r-- 1 root wheel 3377383 37 "May 27 05:45:21 2020" "May 27 05:45:21 2020" "May 27 05:45:21 2020" "May 27 05:45:21 2020" 32768 8 0 /etc/hostid
93 1685465 -rw-r--r-- 1 root wheel 3377511 1096 "May 28 23:02:58 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/hosts
93 1685421 -rw-r--r-- 1 root wheel 3377420 3467 "May 28 23:01:05 2020" "Oct 31 21:26:42 2019" "May 27 05:40:03 2020" "Oct 31 21:26:42 2019" 32768 8 0 /etc/hosts.allow
93 1685378 -rw-r--r-- 1 root wheel 3370941 124 "May 27 05:40:02 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/hosts.equiv
93 1685454 -rw-r--r-- 1 root wheel 3370953 116 "May 27 05:40:02 2020" "Oct 31 21:31:37 2019" "May 27 05:40:03 2020" "Oct 31 21:31:37 2019" 32768 8 0 /etc/hosts.lpd
93 1685395 -rw-r--r-- 1 root wheel 3377377 5290 "May 27 05:40:02 2020" "Oct 31 21:31:35 2019" "May 27 05:40:03 2020" "Oct 31 21:31:35 2019" 32768 16 0 /etc/inetd.conf
93 1685455 -rw-r--r-- 1 root wheel 3370954 252 "May 27 05:40:02 2020" "Oct 31 21:26:05 2019" "May 27 05:40:03 2020" "Oct 31 21:26:05 2019" 32768 8 0 /etc/libalias.conf
93 1685782 -rw-r--r-- 1 root wheel 3377823 122 "May 28 23:36:49 2020" "Oct 31 21:33:42 2019" "May 27 05:40:37 2020" "Oct 31 21:33:42 2019" 32768 8 0 /etc/libmap.conf
93 1685384 -r--r--r-- 1 root wheel 3377429 2819 "May 28 23:36:49 2020" "May 27 05:42:43 2020" "May 27 05:42:43 2020" "May 27 05:42:43 2020" 32768 8 0 /etc/localtime
93 1685473 -rw-r--r-- 1 root wheel 3377519 969 "May 27 05:40:02 2020" "Oct 31 21:30:24 2019" "May 27 05:40:03 2020" "Oct 31 21:30:24 2019" 32768 8 0 /etc/locate.rc
93 1685389 -rw-r--r-- 1 root wheel 3377371 1853 "May 28 23:01:07 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 8 0 /etc/login.access
93 1685445 -rw-r--r-- 1 root wheel 3377486 6800 "May 27 05:40:02 2020" "Oct 31 21:29:55 2019" "May 27 05:40:03 2020" "Oct 31 21:29:55 2019" 32768 16 0 /etc/login.conf
93 1685441 -rw-r--r-- 1 root wheel 3377466 16384 "May 28 23:35:00 2020" "Oct 31 21:29:55 2019" "May 27 05:40:03 2020" "Oct 31 21:29:55 2019" 32768 32 0 /etc/login.conf.db
93 1685437 -rw-r--r-- 1 root wheel 3377454 579 "May 28 22:11:10 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/mac.conf
93 1685429 drwxr-xr-x 3 root wheel 3370949 512 "May 27 05:40:02 2020" "May 27 12:46:06 2020" "May 27 12:46:06 2020" "Oct 31 21:32:27 2019" 32768 8 0 /etc/mail
93 1685460 -rw-r--r-- 1 root wheel 3370959 106 "May 28 03:01:45 2020" "Oct 31 21:30:25 2019" "May 27 05:40:03 2020" "Oct 31 21:30:25 2019" 32768 8 0 /etc/mail.rc
93 1685443 -rw------- 1 root wheel 3370947 2199 "May 28 21:36:50 2020" "May 28 21:36:50 2020" "May 28 21:36:51 2020" "May 28 21:36:50 2020" 32768 8 0 /etc/master.passwd
93 1685394 -rw-r--r-- 1 root wheel 3404046 903 "May 28 21:29:24 2020" "May 27 12:46:05 2020" "May 27 12:46:05 2020" "Oct 31 21:29:55 2019" 32768 8 0 /etc/motd
93 1685410 drwxr-xr-x 2 root wheel 3377396 512 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:25 2020" "Oct 31 21:32:27 2019" 32768 8 0 /etc/mtree
93 1685402 -rw-r--r-- 1 root wheel 3377387 798 "May 27 05:40:02 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/netconfig
93 1685456 -rwxr-xr-x 1 root wheel 3370955 2211 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/netstart
93 1685450 -rw-r--r-- 1 root wheel 3377496 37552 "May 27 12:46:36 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 80 0 /etc/network.subr
93 1685416 -rw-r--r-- 1 root wheel 3377406 378 "May 28 22:50:30 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/networks
93 1685449 -rw-r--r-- 1 root wheel 3377491 1726 "May 28 23:00:00 2020" "Oct 31 21:31:01 2019" "May 27 05:40:03 2020" "Oct 31 21:31:01 2019" 32768 8 0 /etc/newsyslog.conf
93 1685409 drwxr-xr-x 2 root wheel 3377395 512 "May 27 05:40:02 2020" "Oct 31 21:31:01 2019" "May 27 05:40:25 2020" "Oct 31 21:31:01 2019" 32768 8 0 /etc/newsyslog.conf.d
93 1685401 -rw-r--r-- 1 root wheel 3377386 301 "May 27 05:40:02 2020" "Oct 31 21:31:37 2019" "May 27 05:40:03 2020" "Oct 31 21:31:37 2019" 32768 8 0 /etc/nscd.conf
93 1685464 -rw------- 1 root wheel 3377510 1702 "May 27 05:40:02 2020" "Oct 31 21:26:35 2019" "May 27 05:40:03 2020" "Oct 31 21:26:35 2019" 32768 8 0 /etc/nsmb.conf
93 1685391 -rw-r--r-- 1 root wheel 3377373 345 "May 28 23:36:49 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/nsswitch.conf
93 1685407 drwx------ 2 root wheel 3377393 512 "May 27 05:40:02 2020" "Oct 31 21:31:42 2019" "May 27 05:40:25 2020" "Oct 31 21:31:42 2019" 32768 8 0 /etc/ntp
93 1685442 -rw-r--r-- 1 root wheel 3377470 3997 "May 28 23:00:16 2020" "Oct 31 21:31:42 2019" "May 27 05:40:03 2020" "Oct 31 21:31:42 2019" 32768 8 0 /etc/ntp.conf
93 1685420 -rw------- 1 root wheel 3377419 446 "May 27 05:40:02 2020" "Oct 31 21:26:26 2019" "May 27 05:40:03 2020" "Oct 31 21:26:26 2019" 32768 8 0 /etc/opieaccess
93 1710173 -rw------- 1 root wheel 0 0 "May 28 23:01:05 2020" "May 27 12:46:39 2020" "May 27 12:46:39 2020" "May 27 12:46:39 2020" 32768 0 0 /etc/opiekeys
93 1685470 drwxr-xr-x 2 root wheel 3377516 512 "May 27 05:40:37 2020" "May 27 05:40:37 2020" "May 27 05:40:37 2020" "Oct 31 21:26:29 2019" 32768 8 0 /etc/pam.d
93 1711921 -rw-r--r-- 1 root wheel 3377348 1838 "May 28 23:10:18 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" 32768 8 0 /etc/passwd
93 1685387 -rwxr-xr-x 1 root wheel 3377369 2816 "May 27 05:45:37 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/pccard_ether
93 1685459 drwxr-xr-x 6 root wheel 3370958 512 "May 27 05:40:02 2020" "Oct 31 21:25:13 2019" "May 27 05:40:25 2020" "Oct 31 21:25:13 2019" 32768 8 0 /etc/periodic
93 1685382 -rw-r--r-- 1 root wheel 3377352 29348 "May 27 05:40:02 2020" "Oct 31 21:28:10 2019" "May 27 05:40:03 2020" "Oct 31 21:28:10 2019" 32768 64 0 /etc/pf.os
93 1685462 -rw-r--r-- 1 root wheel 3377508 252 "May 27 05:40:02 2020" "Oct 31 21:30:08 2019" "May 27 05:40:03 2020" "Oct 31 21:30:08 2019" 32768 8 0 /etc/phones
93 1685393 drwxr-xr-x 2 root wheel 3377375 512 "May 27 05:40:02 2020" "Oct 31 21:31:45 2019" "May 27 05:40:25 2020" "Oct 31 21:31:45 2019" 32768 8 0 /etc/pkg
93 1685457 -rw-r--r-- 1 root wheel 3370956 1512 "May 27 13:02:42 2020" "Oct 31 21:31:46 2019" "May 27 05:40:03 2020" "Oct 31 21:31:46 2019" 32768 8 0 /etc/portsnap.conf
93 1685448 drwxr-xr-x 2 root wheel 3377490 512 "May 27 05:40:02 2020" "Oct 31 21:31:47 2019" "May 27 05:40:25 2020" "Oct 31 21:31:47 2019" 32768 8 0 /etc/ppp
93 1685423 -rw-r--r-- 1 root wheel 3377422 2072 "May 27 05:40:02 2020" "Oct 31 21:31:37 2019" "May 27 05:40:03 2020" "Oct 31 21:31:37 2019" 32768 8 0 /etc/printcap
93 1685388 -rw-r--r-- 1 root wheel 3377370 623 "May 28 21:29:24 2020" "Oct 31 21:27:26 2019" "May 27 05:40:03 2020" "Oct 31 21:27:26 2019" 32768 8 0 /etc/profile
93 1685403 -rw-r--r-- 1 root wheel 3377388 6463 "May 27 05:40:02 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 16 0 /etc/protocols
93 1710163 -rw-r--r-- 1 root wheel 3377360 40960 "May 28 23:36:49 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" 32768 80 0 /etc/pwd.db
93 1685469 -rw-r--r-- 1 root wheel 3377514 5043 "May 27 05:45:38 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 16 0 /etc/rc
93 1685396 -rw-r--r-- 1 root wheel 3377379 4612 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 16 0 /etc/rc.bsdextended
93 1710165 -rw-r--r-- 1 root wheel 3403953 213 "May 28 23:33:00 2020" "May 27 05:44:32 2020" "May 27 05:44:32 2020" "May 27 05:44:32 2020" 32768 8 0 /etc/rc.conf
93 1685411 drwxr-xr-x 2 root wheel 3377397 512 "May 27 05:40:02 2020" "Oct 31 21:25:13 2019" "May 27 05:40:25 2020" "Oct 31 21:25:13 2019" 32768 8 0 /etc/rc.conf.d
93 1685405 drwxr-xr-x 2 root wheel 3377391 3072 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:25 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/rc.d
93 1685431 -rw-r--r-- 1 root wheel 3377424 18803 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 40 0 /etc/rc.firewall
93 1685461 -rw-r--r-- 1 root wheel 3377504 13660 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 32 0 /etc/rc.initdiskless
93 1685386 -rwxr-xr-x 1 root wheel 3377368 2522 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/rc.resume
93 1685426 -rw-r--r-- 1 root wheel 3370945 5791 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 16 0 /etc/rc.sendmail
93 1685414 -rw-r--r-- 1 root wheel 3377400 3440 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/rc.shutdown
93 1685415 -rw-r--r-- 1 root wheel 3377408 50816 "May 28 23:00:16 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 104 0 /etc/rc.subr
93 1685446 -rwxr-xr-x 1 root wheel 3377488 2334 "May 27 05:40:02 2020" "Oct 31 21:27:18 2019" "May 27 05:40:03 2020" "Oct 31 21:27:18 2019" 32768 8 0 /etc/rc.suspend
93 1685444 -rw-r--r-- 1 root wheel 3377472 53728 "May 27 05:40:02 2020" "Oct 31 21:26:26 2019" "May 27 05:40:03 2020" "Oct 31 21:26:26 2019" 32768 112 0 /etc/regdomain.xml
93 1685413 -rw-r--r-- 1 root wheel 3377399 2708 "May 27 05:40:02 2020" "Oct 31 21:30:08 2019" "May 27 05:40:03 2020" "Oct 31 21:30:08 2019" 32768 8 0 /etc/remote
93 1710166 -rw-r--r-- 1 root wheel 3401639 70 "May 28 23:01:05 2020" "May 27 13:01:01 2020" "May 27 13:01:01 2020" "May 27 05:44:32 2020" 32768 8 0 /etc/resolv.conf
93 1710161 -rw-r--r-- 1 root wheel 3401638 44 "May 27 13:00:57 2020" "May 27 13:01:01 2020" "May 27 13:01:01 2020" "May 27 05:45:40 2020" 32768 8 0 /etc/resolv.conf.bak
93 1685379 lrwxr-xr-x 1 root wheel 8299978478479945262 15 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 0 0 /etc/rmt
93 1685471 -rw-r--r-- 1 root wheel 3377517 1683 "May 27 05:40:02 2020" "Oct 31 21:25:54 2019" "May 27 05:40:03 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/rpc
93 1685447 drwxr-xr-x 2 root wheel 3377489 512 "May 27 05:40:02 2020" "Oct 31 21:31:23 2019" "May 27 05:40:25 2020" "Oct 31 21:31:23 2019" 32768 8 0 /etc/security
93 1685436 -rw-r--r-- 1 root wheel 3377432 86637 "May 28 23:02:58 2020" "Oct 31 21:31:06 2019" "May 27 05:40:03 2020" "Oct 31 21:31:06 2019" 32768 176 0 /etc/services
93 1685427 -rw-r--r-- 1 root wheel 3377471 310 "May 28 21:36:52 2020" "May 28 21:36:52 2020" "May 28 21:36:52 2020" "Oct 31 21:25:54 2019" 32768 8 0 /etc/shells
93 1685380 -rw------- 1 root wheel 3377344 9896 "May 27 05:40:02 2020" "Oct 31 21:31:29 2019" "May 27 05:40:03 2020" "Oct 31 21:31:29 2019" 32768 24 0 /etc/snmpd.config
93 1710164 -rw------- 1 root wheel 3377456 40960 "May 28 23:35:00 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" "May 28 21:36:50 2020" 32768 80 0 /etc/spwd.db
93 1685435 drwxr-xr-x 2 root wheel 3377431 512 "May 27 05:40:02 2020" "May 27 12:46:05 2020" "May 27 12:46:05 2020" "Oct 31 21:28:52 2019" 32768 8 0 /etc/ssh
93 1685468 drwxr-xr-x 2 root wheel 3377513 512 "May 27 05:40:02 2020" "May 28 21:36:37 2020" "May 28 21:36:37 2020" "Oct 31 21:28:49 2019" 32768 8 0 /etc/ssl
93 1685400 -rw-r--r-- 1 root wheel 3403619 381 "May 27 12:46:36 2020" "May 27 05:44:32 2020" "May 27 05:44:32 2020" "Oct 31 21:28:05 2019" 32768 8 0 /etc/sysctl.conf
93 1685438 -rw-r--r-- 1 root wheel 3377455 1472 "May 28 00:00:00 2020" "Oct 31 21:31:07 2019" "May 27 05:40:03 2020" "Oct 31 21:31:07 2019" 32768 8 0 /etc/syslog.conf
93 1685451 drwxr-xr-x 2 root wheel 3377494 512 "May 27 05:40:02 2020" "Oct 31 21:31:07 2019" "May 27 05:40:25 2020" "Oct 31 21:31:07 2019" 32768 8 0 /etc/syslog.d
93 1685467 lrwxr-xr-x 1 root wheel 7018986666877744431 23 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 0 0 /etc/termcap
93 1685377 -rw-r--r-- 1 root wheel 3370937 12297 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 32 0 /etc/termcap.small
93 1685452 -rw-r--r-- 1 root wheel 3377495 2153 "May 28 23:00:16 2020" "Oct 31 21:28:02 2019" "May 27 05:40:03 2020" "Oct 31 21:28:02 2019" 32768 8 0 /etc/ttys
93 1685440 lrwxr-xr-x 1 root wheel 8444093589263167022 14 "May 27 05:40:02 2020" "Oct 31 21:32:27 2019" "May 27 05:40:03 2020" "Oct 31 21:32:27 2019" 32768 0 0 /etc/unbound
93 1685453 drwxr-xr-x 2 root wheel 3370952 512 "May 27 05:40:02 2020" "Oct 31 21:25:13 2019" "May 27 05:40:25 2020" "Oct 31 21:25:13 2019" 32768 8 0 /etc/zfs

1
tests/fixtures/nixos/w.json vendored Normal file
View File

@ -0,0 +1 @@
[{"user": "kbrazil", "tty": "tty1", "login_at": "23:40", "idle": "0.00s", "jcpu": "0.18s", "pcpu": "0.07s", "what": "ssh localhost"}, {"user": "kbrazil", "tty": "pts/0", "login_at": "23:43", "idle": "1:37", "jcpu": "0.05s", "pcpu": "0.05s", "what": "-bash"}, {"user": "kbrazil", "tty": "pts/1", "login_at": "23:46", "idle": "0.00s", "jcpu": "0.02s", "pcpu": "0.00s", "what": "sshd: kbrazil [priv]"}]

5
tests/fixtures/nixos/w.out vendored Normal file
View File

@ -0,0 +1,5 @@
23:50:09 up 10 min, 3 users, load average: 0.00, 0.03, 0.01
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
kbrazil tty1 23:40 0.00s 0.18s 0.07s ssh localhost
kbrazil pts/0 23:43 1:37 0.05s 0.05s -bash
kbrazil pts/1 23:46 0.00s 0.02s 0.00s sshd: kbrazil [priv]

View File

@ -1 +1,106 @@
[{"name": "dev.attlocal.net", "address": "192.168.1.63", "hwtype": "ethernet", "hwaddress": "e0:33:8e:67:38:d6", "iface": "en0"}, {"name": "air.attlocal.net", "address": "192.168.1.66", "hwtype": "ethernet", "hwaddress": "60:c5:47:b:cf:a", "iface": "en0"}, {"name": "ipad.attlocal.net", "address": "192.168.1.76", "hwtype": "ethernet", "hwaddress": "4c:56:9d:6f:b7:4c", "iface": "en0"}, {"name": "storage.attlocal.net", "address": "192.168.1.81", "hwtype": "ethernet", "hwaddress": "0:90:a9:fd:e4:35", "iface": "en0"}, {"name": "family-room.attlocal.net", "address": "192.168.1.89", "hwtype": "ethernet", "hwaddress": "c8:d0:83:cd:f3:2d", "iface": "en0"}, {"name": "bedroom.attlocal.net", "address": "192.168.1.80", "hwtype": "ethernet", "hwaddress": "d0:3:4b:3b:29:d5", "iface": "en0"}, {"name": "upstairs.attlocal.net", "address": "192.168.1.187", "hwtype": "ethernet", "hwaddress": "50:32:37:e7:f5:9b", "iface": "en0"}, {"name": "rb.attlocal.net", "address": "192.168.1.218", "hwtype": "ethernet", "hwaddress": "3c:37:86:15:bd:f7", "iface": "en0"}, {"name": "mac.attlocal.net", "address": "192.168.1.220", "hwtype": "ethernet", "hwaddress": "a4:83:f7:2d:62:8f", "iface": "en0"}, {"name": "rbs.attlocal.net", "address": "192.168.1.252", "hwtype": "ethernet", "hwaddress": "3c:37:86:15:de:b3", "iface": "en0"}, {"name": "dev1.attlocal.net", "address": "192.168.1.253", "hwtype": "ethernet", "hwaddress": "fc:ae:34:a1:3b:80", "iface": "en0"}, {"name": null, "address": "224.0.0.251", "hwtype": "ethernet", "hwaddress": "1:0:5e:0:0:fb", "iface": "en0"}, {"name": null, "address": "239.255.255.250", "hwtype": "ethernet", "hwaddress": "1:0:5e:7f:ff:fa", "iface": "en0"}]
[
{
"name": "dev.attlocal.net",
"address": "192.168.1.63",
"hwtype": "ethernet",
"hwaddress": "e0:33:8e:67:38:d6",
"iface": "en0",
"permanent": false
},
{
"name": "air.attlocal.net",
"address": "192.168.1.66",
"hwtype": "ethernet",
"hwaddress": "60:c5:47:b:cf:a",
"iface": "en0",
"permanent": false
},
{
"name": "ipad.attlocal.net",
"address": "192.168.1.76",
"hwtype": "ethernet",
"hwaddress": "4c:56:9d:6f:b7:4c",
"iface": "en0",
"permanent": false
},
{
"name": "storage.attlocal.net",
"address": "192.168.1.81",
"hwtype": "ethernet",
"hwaddress": "0:90:a9:fd:e4:35",
"iface": "en0",
"permanent": false
},
{
"name": "family-room.attlocal.net",
"address": "192.168.1.89",
"hwtype": "ethernet",
"hwaddress": "c8:d0:83:cd:f3:2d",
"iface": "en0",
"permanent": false
},
{
"name": "bedroom.attlocal.net",
"address": "192.168.1.80",
"hwtype": "ethernet",
"hwaddress": "d0:3:4b:3b:29:d5",
"iface": "en0",
"permanent": false
},
{
"name": "upstairs.attlocal.net",
"address": "192.168.1.187",
"hwtype": "ethernet",
"hwaddress": "50:32:37:e7:f5:9b",
"iface": "en0",
"permanent": false
},
{
"name": "rb.attlocal.net",
"address": "192.168.1.218",
"hwtype": "ethernet",
"hwaddress": "3c:37:86:15:bd:f7",
"iface": "en0",
"permanent": false
},
{
"name": "mac.attlocal.net",
"address": "192.168.1.220",
"hwtype": "ethernet",
"hwaddress": "a4:83:f7:2d:62:8f",
"iface": "en0",
"permanent": false
},
{
"name": "rbs.attlocal.net",
"address": "192.168.1.252",
"hwtype": "ethernet",
"hwaddress": "3c:37:86:15:de:b3",
"iface": "en0",
"permanent": false
},
{
"name": "dev1.attlocal.net",
"address": "192.168.1.253",
"hwtype": "ethernet",
"hwaddress": "fc:ae:34:a1:3b:80",
"iface": "en0",
"permanent": false
},
{
"name": null,
"address": "224.0.0.251",
"hwtype": "ethernet",
"hwaddress": "1:0:5e:0:0:fb",
"iface": "en0",
"permanent": true
},
{
"name": null,
"address": "239.255.255.250",
"hwtype": "ethernet",
"hwaddress": "1:0:5e:7f:ff:fa",
"iface": "en0",
"permanent": true
}
]

View File

@ -1 +1,98 @@
[{"name": "xxx.attlocal.net", "address": "192.168.1.63", "hwtype": "ethernet", "hwaddress": "e0:33:8e:67:38:d6", "iface": "en0"}, {"name": "mbp.attlocal.net", "address": "192.168.1.74", "hwtype": "ethernet", "hwaddress": "f0:18:98:5:d8:39", "iface": "en0"}, {"name": "tablet.attlocal.net", "address": "192.168.1.77", "hwtype": "ethernet", "hwaddress": "4c:56:9d:5f:b8:4c", "iface": "en0"}, {"name": "living-room.attlocal.net", "address": "192.168.1.80", "hwtype": "ethernet", "hwaddress": "c8:d0:83:cd:f3:2d", "iface": "en0"}, {"name": "outside.attlocal.net", "address": "192.168.1.99", "hwtype": "ethernet", "hwaddress": "d0:3:4b:3b:27:d5", "iface": "en0"}, {"name": "tv.attlocal.net", "address": "192.168.1.187", "hwtype": "ethernet", "hwaddress": "50:32:37:d7:f4:9b", "iface": "en0"}, {"name": "device.attlocal.net", "address": "192.168.1.217", "hwtype": "ethernet", "hwaddress": "3c:37:86:14:ad:f7", "iface": "en0"}, {"name": "mac.attlocal.net", "address": "192.168.1.222", "hwtype": "ethernet", "hwaddress": "a4:83:e7:2d:63:8f", "iface": "en0"}, {"name": "dev2.attlocal.net", "address": "192.168.1.251", "hwtype": "ethernet", "hwaddress": "3c:37:86:15:df:b3", "iface": "en0"}, {"name": "laptop.attlocal.net", "address": "192.168.1.250", "hwtype": "ethernet", "hwaddress": "fc:ae:34:a1:3a:80", "iface": "en0"}, {"name": null, "address": "224.0.0.251", "hwtype": "ethernet", "hwaddress": "1:0:5e:0:0:fb", "iface": "en0"}, {"name": null, "address": "239.255.255.250", "hwtype": "ethernet", "hwaddress": "1:0:5e:7f:ff:fa", "iface": "en0"}]
[
{
"name": "xxx.attlocal.net",
"address": "192.168.1.63",
"hwtype": "ethernet",
"hwaddress": "e0:33:8e:67:38:d6",
"iface": "en0",
"permanent": false
},
{
"name": "mbp.attlocal.net",
"address": "192.168.1.74",
"hwtype": "ethernet",
"hwaddress": "f0:18:98:5:d8:39",
"iface": "en0",
"permanent": false
},
{
"name": "tablet.attlocal.net",
"address": "192.168.1.77",
"hwtype": "ethernet",
"hwaddress": "4c:56:9d:5f:b8:4c",
"iface": "en0",
"permanent": false
},
{
"name": "living-room.attlocal.net",
"address": "192.168.1.80",
"hwtype": "ethernet",
"hwaddress": "c8:d0:83:cd:f3:2d",
"iface": "en0",
"permanent": false
},
{
"name": "outside.attlocal.net",
"address": "192.168.1.99",
"hwtype": "ethernet",
"hwaddress": "d0:3:4b:3b:27:d5",
"iface": "en0",
"permanent": false
},
{
"name": "tv.attlocal.net",
"address": "192.168.1.187",
"hwtype": "ethernet",
"hwaddress": "50:32:37:d7:f4:9b",
"iface": "en0",
"permanent": false
},
{
"name": "device.attlocal.net",
"address": "192.168.1.217",
"hwtype": "ethernet",
"hwaddress": "3c:37:86:14:ad:f7",
"iface": "en0",
"permanent": false
},
{
"name": "mac.attlocal.net",
"address": "192.168.1.222",
"hwtype": "ethernet",
"hwaddress": "a4:83:e7:2d:63:8f",
"iface": "en0",
"permanent": true
},
{
"name": "dev2.attlocal.net",
"address": "192.168.1.251",
"hwtype": "ethernet",
"hwaddress": "3c:37:86:15:df:b3",
"iface": "en0",
"permanent": false
},
{
"name": "laptop.attlocal.net",
"address": "192.168.1.250",
"hwtype": "ethernet",
"hwaddress": "fc:ae:34:a1:3a:80",
"iface": "en0",
"permanent": false
},
{
"name": null,
"address": "224.0.0.251",
"hwtype": "ethernet",
"hwaddress": "1:0:5e:0:0:fb",
"iface": "en0",
"permanent": true
},
{
"name": null,
"address": "239.255.255.250",
"hwtype": "ethernet",
"hwaddress": "1:0:5e:7f:ff:fa",
"iface": "en0",
"permanent": true
}
]

View File

@ -1 +1 @@
[{"name": null, "address": "169.254.81.142", "hwtype": "ethernet", "hwaddress": "60:93:17:3a:28:fc", "iface": "en0"}, {"name": "my-iphone.attlocal.net", "address": "192.168.1.64", "hwtype": "ethernet", "hwaddress": "e0:33:8f:68:39:d6", "iface": "en0"}, {"name": "my-mbp.attlocal.net", "address": "192.168.1.72", "hwtype": "ethernet", "hwaddress": "f0:18:98:3:d7:34", "iface": "en0"}, {"name": "c6180.attlocal.net", "address": "192.168.1.74", "hwtype": "ethernet", "hwaddress": "9c:b6:54:5f:fa:7c", "iface": "en0"}, {"name": "ipad.attlocal.net", "address": "192.168.1.75", "hwtype": "ethernet", "hwaddress": "4c:56:9e:5f:c7:4c", "iface": "en0"}, {"name": "mycloudex2ultra.attlocal.net", "address": "192.168.1.80", "hwtype": "ethernet", "hwaddress": "0:90:a9:ed:f4:3f", "iface": "en0"}, {"name": "family-room-5.attlocal.net", "address": "192.168.1.88", "hwtype": "ethernet", "hwaddress": "c8:d0:84:c3:e3:2d", "iface": "en0"}, {"name": "bedroom.attlocal.net", "address": "192.168.1.89", "hwtype": "ethernet", "hwaddress": "d0:3:4b:3b:29:a5", "iface": "en0"}, {"name": "heriphone.attlocal.net", "address": "192.168.1.178", "hwtype": "ethernet", "hwaddress": "90:e1:7b:ef:1:45", "iface": "en0"}, {"name": "upstairs.attlocal.net", "address": "192.168.1.186", "hwtype": "ethernet", "hwaddress": "50:32:37:d7:e5:7b", "iface": "en0"}, {"name": "rbr50.attlocal.net", "address": "192.168.1.216", "hwtype": "ethernet", "hwaddress": "3c:37:86:25:fd:f7", "iface": "en0"}, {"name": "my-mac.attlocal.net", "address": "192.168.1.221", "hwtype": "ethernet", "hwaddress": "a4:83:e7:2e:f2:8f", "iface": "en0"}, {"name": "irobot-d41934.attlocal.net", "address": "192.168.1.242", "hwtype": "ethernet", "hwaddress": "50:14:79:f2:4f:3e", "iface": "en0"}, {"name": "rbs50.attlocal.net", "address": "192.168.1.253", "hwtype": "ethernet", "hwaddress": "3c:37:86:1f:dd:a3", "iface": "en0"}, {"name": "dsldevice.attlocal.net", "address": "192.168.1.254", "hwtype": "ethernet", "hwaddress": "fc:ae:34:f1:3f:80", "iface": "en0"}, {"name": null, "address": "192.168.1.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "en0"}, {"name": null, "address": "192.168.71.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "vmnet8"}, {"name": null, "address": "192.168.101.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "vmnet1"}, {"name": null, "address": "224.0.0.251", "hwtype": "ethernet", "hwaddress": "1:0:5e:0:0:eb", "iface": "en0"}, {"name": null, "address": "239.255.255.250", "hwtype": "ethernet", "hwaddress": "1:0:5e:7f:ff:fe", "iface": "en0"}]
[{"name": null, "address": "169.254.81.142", "hwtype": "ethernet", "hwaddress": "60:93:17:3a:28:fc", "iface": "en0", "permanent": false}, {"name": "my-iphone.attlocal.net", "address": "192.168.1.64", "hwtype": "ethernet", "hwaddress": "e0:33:8f:68:39:d6", "iface": "en0", "permanent": false}, {"name": "my-mbp.attlocal.net", "address": "192.168.1.72", "hwtype": "ethernet", "hwaddress": "f0:18:98:3:d7:34", "iface": "en0", "permanent": false}, {"name": "c6180.attlocal.net", "address": "192.168.1.74", "hwtype": "ethernet", "hwaddress": "9c:b6:54:5f:fa:7c", "iface": "en0", "permanent": false}, {"name": "ipad.attlocal.net", "address": "192.168.1.75", "hwtype": "ethernet", "hwaddress": "4c:56:9e:5f:c7:4c", "iface": "en0", "permanent": false}, {"name": "mycloudex2ultra.attlocal.net", "address": "192.168.1.80", "hwtype": "ethernet", "hwaddress": "0:90:a9:ed:f4:3f", "iface": "en0", "permanent": false}, {"name": "family-room-5.attlocal.net", "address": "192.168.1.88", "hwtype": "ethernet", "hwaddress": "c8:d0:84:c3:e3:2d", "iface": "en0", "permanent": false}, {"name": "bedroom.attlocal.net", "address": "192.168.1.89", "hwtype": "ethernet", "hwaddress": "d0:3:4b:3b:29:a5", "iface": "en0", "permanent": false}, {"name": "heriphone.attlocal.net", "address": "192.168.1.178", "hwtype": "ethernet", "hwaddress": "90:e1:7b:ef:1:45", "iface": "en0", "permanent": false}, {"name": "upstairs.attlocal.net", "address": "192.168.1.186", "hwtype": "ethernet", "hwaddress": "50:32:37:d7:e5:7b", "iface": "en0", "permanent": false}, {"name": "rbr50.attlocal.net", "address": "192.168.1.216", "hwtype": "ethernet", "hwaddress": "3c:37:86:25:fd:f7", "iface": "en0", "permanent": false}, {"name": "my-mac.attlocal.net", "address": "192.168.1.221", "hwtype": "ethernet", "hwaddress": "a4:83:e7:2e:f2:8f", "iface": "en0", "permanent": true}, {"name": "irobot-d41934.attlocal.net", "address": "192.168.1.242", "hwtype": "ethernet", "hwaddress": "50:14:79:f2:4f:3e", "iface": "en0", "permanent": false}, {"name": "rbs50.attlocal.net", "address": "192.168.1.253", "hwtype": "ethernet", "hwaddress": "3c:37:86:1f:dd:a3", "iface": "en0", "permanent": false}, {"name": "dsldevice.attlocal.net", "address": "192.168.1.254", "hwtype": "ethernet", "hwaddress": "fc:ae:34:f1:3f:80", "iface": "en0", "permanent": false}, {"name": null, "address": "192.168.1.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "en0", "permanent": false}, {"name": null, "address": "192.168.71.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "vmnet8", "permanent": false}, {"name": null, "address": "192.168.101.255", "hwtype": "ethernet", "hwaddress": "ff:ff:ff:ff:ff:ff", "iface": "vmnet1", "permanent": false}, {"name": null, "address": "224.0.0.251", "hwtype": "ethernet", "hwaddress": "1:0:5e:0:0:eb", "iface": "en0", "permanent": true}, {"name": null, "address": "239.255.255.250", "hwtype": "ethernet", "hwaddress": "1:0:5e:7f:ff:fe", "iface": "en0", "permanent": true}]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
[{"destination": "default", "gateway": "_gateway", "genmask": "0.0.0.0", "route_flags": "UG", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route"}, {"destination": "_gateway", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route"}]
[{"destination": "default", "gateway": "_gateway", "genmask": "0.0.0.0", "route_flags": "UG", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "_gateway", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "mss": 0, "window": 0, "irtt": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "HOST"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route"}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "kind": "route", "route_flags_pretty": ["UP", "HOST"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "route_flags": "UG", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "route_flags": "U", "metric": 0, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP"]}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "route_flags": "UH", "metric": 100, "route_refs": 0, "use": 0, "iface": "ens33", "mss": 0, "window": 0, "irtt": 0, "kind": "route", "route_flags_pretty": ["UP", "HOST"]}]

View File

@ -1 +1 @@
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "flags": "UH", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}]
[{"destination": "0.0.0.0", "gateway": "192.168.71.2", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP"]}, {"destination": "192.168.71.2", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "flags": "UH", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "HOST"]}]

View File

@ -1 +1 @@
[{"destination": "default", "gateway": "_gateway", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "ens33"}, {"destination": "_gateway", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "flags": "UH", "metric": 100, "ref": 0, "use": 0, "iface": "ens33"}]
[{"destination": "default", "gateway": "_gateway", "genmask": "0.0.0.0", "flags": "UG", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "GATEWAY"]}, {"destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", "metric": 0, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP"]}, {"destination": "_gateway", "gateway": "0.0.0.0", "genmask": "255.255.255.255", "flags": "UH", "metric": 100, "ref": 0, "use": 0, "iface": "ens33", "flags_pretty": ["UP", "HOST"]}]

View File

@ -37,6 +37,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a2.out'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_arp_a2 = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/arp-a.out'), 'r', encoding='utf-8') as f:
self.freebsd_arp_a = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/arp.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_arp_json = json.loads(f.read())
@ -65,6 +68,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/arp-a2.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_arp_a2_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/arp-a.json'), 'r', encoding='utf-8') as f:
self.freebsd12_arp_a_json = json.loads(f.read())
def test_arp_centos_7_7(self):
"""
Test 'arp' on Centos 7.7
@ -119,6 +125,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.arp.parse(self.osx_10_14_6_arp_a2, quiet=True), self.osx_10_14_6_arp_a2_json)
def test_arp_a_freebsd12(self):
"""
Test 'arp -a' on FreeBSD12
"""
self.assertEqual(jc.parsers.arp.parse(self.freebsd_arp_a, quiet=True), self.freebsd12_arp_a_json)
if __name__ == '__main__':
unittest.main()

View File

@ -34,6 +34,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/last.out'), 'r', encoding='utf-8') as f:
self.fedora32_last = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.out'), 'r', encoding='utf-8') as f:
self.freebsd12_last = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_json = json.loads(f.read())
@ -59,6 +62,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/last.json'), 'r', encoding='utf-8') as f:
self.fedora32_last_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/last.json'), 'r', encoding='utf-8') as f:
self.freebsd12_last_json = json.loads(f.read())
def test_last_centos_7_7(self):
"""
Test plain 'last' on Centos 7.7
@ -107,6 +113,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.last.parse(self.fedora32_last, quiet=True), self.fedora32_last_json)
def test_last_freebsd12(self):
"""
Test plain 'last' on FreeBSD12
"""
self.assertEqual(jc.parsers.last.parse(self.freebsd12_last, quiet=True), self.freebsd12_last_json)
if __name__ == '__main__':
unittest.main()

View File

@ -56,6 +56,24 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-Abn.out'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_Abn = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-Aa.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_Aa = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-an.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_an = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-AanP.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_AanP = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-AaT.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_AaT = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-Aax.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_Aax = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-aT.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_aT = f.read()
# netstat -r
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/netstat-r.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_netstat_r = f.read()
@ -81,6 +99,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-rnl.out'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_rnl = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-r.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_r = f.read()
# netstat -i
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/netstat-i.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_netstat_i = f.read()
@ -91,6 +112,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-i.out'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_i = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-i.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_i = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-ib.out'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_ib = f.read()
#
# output
#
@ -138,6 +165,24 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-Abn.json'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_Abn_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-Aa.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_Aa_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-AanP.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_AanP_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-AaT.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_AaT_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-Aax.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_Aax_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-aT.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_aT_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-an.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_an_json = json.loads(f.read())
# netsat -r
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/netstat-r.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_netstat_r_json = json.loads(f.read())
@ -163,6 +208,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-rnl.json'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_rnl_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-r.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_r_json = json.loads(f.read())
# netstat -i
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/netstat-i.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_netstat_i_json = json.loads(f.read())
@ -173,6 +221,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/netstat-i.json'), 'r', encoding='utf-8') as f:
self.osx_14_6_netstat_i_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-i.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_i_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/netstat-ib.json'), 'r', encoding='utf-8') as f:
self.freebsd12_netstat_ib_json = json.loads(f.read())
def test_netstat_centos_7_7(self):
"""
Test 'netstat' on Centos 7.7
@ -239,24 +293,60 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.netstat.parse(self.fedora32_netstat, quiet=True), self.fedora32_netstat_json)
def test_netstat_osx_16_4(self):
def test_netstat_osx_14_6(self):
"""
Test 'netstat' on OSX 16.4
Test 'netstat' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat, quiet=True), self.osx_14_6_netstat_json)
def test_netstat_An_osx_16_4(self):
def test_netstat_An_osx_14_6(self):
"""
Test 'netstat -An' on OSX 16.4
Test 'netstat -An' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat_An, quiet=True), self.osx_14_6_netstat_An_json)
def test_netstat_Abn_osx_16_4(self):
def test_netstat_Abn_osx_14_6(self):
"""
Test 'netstat -Abn' on OSX 16.4
Test 'netstat -Abn' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat_Abn, quiet=True), self.osx_14_6_netstat_Abn_json)
def test_netstat_Aa_freebsd12(self):
"""
Test 'netstat -Aa' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_Aa, quiet=True), self.freebsd12_netstat_Aa_json)
def test_netstat_AanP_freebsd12(self):
"""
Test 'netstat -AanP' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_AanP, quiet=True), self.freebsd12_netstat_AanP_json)
def test_netstat_AaT_freebsd12(self):
"""
Test 'netstat -AaT' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_AaT, quiet=True), self.freebsd12_netstat_AaT_json)
def test_netstat_Aax_freebsd12(self):
"""
Test 'netstat -Aax' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_Aax, quiet=True), self.freebsd12_netstat_Aax_json)
def test_netstat_aT_freebsd12(self):
"""
Test 'netstat -aT' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_aT, quiet=True), self.freebsd12_netstat_aT_json)
def test_netstat_an_freebsd12(self):
"""
Test 'netstat -an' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_an, quiet=True), self.freebsd12_netstat_an_json)
def test_netstat_r_centos_7_7(self):
"""
Test 'netstat -r' on Centos 7.7
@ -293,18 +383,24 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.netstat.parse(self.ubuntu_18_4_netstat_rnee, quiet=True), self.ubuntu_18_4_netstat_rnee_json)
def test_netstat_r_osx_16_4(self):
def test_netstat_r_osx_14_6(self):
"""
Test 'netstat -r' on OSX 16.4
Test 'netstat -r' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat_r, quiet=True), self.osx_14_6_netstat_r_json)
def test_netstat_rnl_osx_16_4(self):
def test_netstat_rnl_osx_14_6(self):
"""
Test 'netstat -rnl' on OSX 16.4
Test 'netstat -rnl' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat_rnl, quiet=True), self.osx_14_6_netstat_rnl_json)
def test_netstat_r_freebsd12(self):
"""
Test 'netstat -r' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_r, quiet=True), self.freebsd12_netstat_r_json)
def test_netstat_i_centos_7_7(self):
"""
Test 'netstat -i' on Centos 7.7
@ -317,12 +413,24 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.netstat.parse(self.ubuntu_18_4_netstat_i, quiet=True), self.ubuntu_18_4_netstat_i_json)
def test_netstat_i_osx_16_4(self):
def test_netstat_i_osx_14_6(self):
"""
Test 'netstat -i' on OSX 16.4
Test 'netstat -i' on OSX 14.6
"""
self.assertEqual(jc.parsers.netstat.parse(self.osx_14_6_netstat_i, quiet=True), self.osx_14_6_netstat_i_json)
def test_netstat_i_freebsd12(self):
"""
Test 'netstat -i' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_i, quiet=True), self.freebsd12_netstat_i_json)
def test_netstat_ib_freebsd12(self):
"""
Test 'netstat -ib' on FreeBSD12
"""
self.assertEqual(jc.parsers.netstat.parse(self.freebsd12_netstat_ib, quiet=True), self.freebsd12_netstat_ib_json)
if __name__ == '__main__':
unittest.main()

View File

@ -25,6 +25,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ntpq-p2.out'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_ntpq_p2 = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ntpq-p.out'), 'r', encoding='utf-8') as f:
self.freebsd12_ntpq_p = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/ntpq-p.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_ntpq_p_json = json.loads(f.read())
@ -41,6 +44,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/ntpq-p2.json'), 'r', encoding='utf-8') as f:
self.ubuntu_18_4_ntpq_p2_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/ntpq-p.json'), 'r', encoding='utf-8') as f:
self.freebsd12_ntpq_p_json = json.loads(f.read())
def test_ntpq_p_centos_7_7(self):
"""
Test 'ntpq -p' on Centos 7.7
@ -71,6 +77,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.ntpq.parse(self.ubuntu_18_4_ntpq_p2, quiet=True), self.ubuntu_18_4_ntpq_p2_json)
def test_ntpq_p_freebsd12(self):
"""
Test 'ntpq -p' on FreeBSD12
"""
self.assertEqual(jc.parsers.ntpq.parse(self.freebsd12_ntpq_p, quiet=True), self.freebsd12_ntpq_p_json)
if __name__ == '__main__':
unittest.main()

View File

@ -19,6 +19,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/stat.out'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_stat = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/stat.out'), 'r', encoding='utf-8') as f:
self.freebsd12_stat = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/stat.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_stat_json = json.loads(f.read())
@ -29,6 +32,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/stat.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_stat_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/freebsd12/stat.json'), 'r', encoding='utf-8') as f:
self.freebsd12_stat_json = json.loads(f.read())
def test_stat_centos_7_7(self):
"""
Test 'stat /bin/*' on Centos 7.7
@ -47,6 +53,12 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.stat.parse(self.osx_10_14_6_stat, quiet=True), self.osx_10_14_6_stat_json)
def test_stat_freebsd12(self):
"""
Test 'stat /foo/*' on FreeBSD12
"""
self.assertEqual(jc.parsers.stat.parse(self.freebsd12_stat, quiet=True), self.freebsd12_stat_json)
if __name__ == '__main__':
unittest.main()

View File

@ -22,6 +22,9 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/w.out'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_w = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/nixos/w.out'), 'r', encoding='utf-8') as f:
self.nixos_w = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/w.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_w_json = json.loads(f.read())
@ -30,10 +33,13 @@ class MyTests(unittest.TestCase):
self.ubuntu_18_4_w_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.11.6/w.json'), 'r', encoding='utf-8') as f:
self.osx_10_11_6_json = json.loads(f.read())
self.osx_10_11_6_w_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/w.json'), 'r', encoding='utf-8') as f:
self.osx_10_14_6_json = json.loads(f.read())
self.osx_10_14_6_w_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/nixos/w.json'), 'r', encoding='utf-8') as f:
self.nixos_w_json = json.loads(f.read())
def test_w_centos_7_7(self):
"""
@ -51,13 +57,19 @@ class MyTests(unittest.TestCase):
"""
Test 'w' on OSX 10.11.6
"""
self.assertEqual(jc.parsers.w.parse(self.osx_10_11_6_w, quiet=True), self.osx_10_11_6_json)
self.assertEqual(jc.parsers.w.parse(self.osx_10_11_6_w, quiet=True), self.osx_10_11_6_w_json)
def test_w_osx_10_14_6(self):
"""
Test 'w' on OSX 10.14.6
"""
self.assertEqual(jc.parsers.w.parse(self.osx_10_14_6_w, quiet=True), self.osx_10_14_6_json)
self.assertEqual(jc.parsers.w.parse(self.osx_10_14_6_w, quiet=True), self.osx_10_14_6_w_json)
def test_w_nixos(self):
"""
Test 'w' on nixos
"""
self.assertEqual(jc.parsers.w.parse(self.nixos_w, quiet=True), self.nixos_w_json)
if __name__ == '__main__':