mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-17 01:32:37 +02:00
freebsd fixes
This commit is contained in:
@ -110,6 +110,9 @@ def process(proc_data):
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
for entry in 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'] == '~':
|
if 'tty' in entry and entry['tty'] == '~':
|
||||||
entry['tty'] = None
|
entry['tty'] = None
|
||||||
|
|
||||||
@ -155,10 +158,11 @@ def parse(data, raw=False, quiet=False):
|
|||||||
for entry in cleandata:
|
for entry in cleandata:
|
||||||
output_line = {}
|
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
|
continue
|
||||||
|
|
||||||
entry = entry.replace('system boot', 'system_boot')
|
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(' still logged in', '- still_logged_in')
|
||||||
entry = entry.replace(' gone - no logout', '- gone_-_no_logout')
|
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])):
|
if re.match(r'[MTWFS][ouerha][nedritnu] [JFMASOND][aepuco][nbrynlgptvc]', ' '.join(linedata[2:4])):
|
||||||
linedata.insert(2, '-')
|
linedata.insert(2, '-')
|
||||||
|
|
||||||
|
# freebsd fix
|
||||||
|
if linedata[0] == 'boot_time':
|
||||||
|
linedata.insert(1, '-')
|
||||||
|
linedata.insert(1, '~')
|
||||||
|
|
||||||
output_line['user'] = linedata[0]
|
output_line['user'] = linedata[0]
|
||||||
output_line['tty'] = linedata[1]
|
output_line['tty'] = linedata[1]
|
||||||
output_line['hostname'] = linedata[2]
|
output_line['hostname'] = linedata[2]
|
||||||
|
Reference in New Issue
Block a user