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

freebsd fixes, tests, and fixtures

This commit is contained in:
Kelly Brazil
2020-05-30 19:50:38 -07:00
parent 4ef961c278
commit fa44d48c09
6 changed files with 129 additions and 7 deletions

View File

@ -11,6 +11,8 @@ jc changelog
- 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)

View File

@ -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)

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

File diff suppressed because one or more lines are too long

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()