From 47d4335890fc84a82502cc207b682a3731c7be0d Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 23 Oct 2023 15:14:28 -0700 Subject: [PATCH] fix for multi-word remote --- jc/parsers/who.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jc/parsers/who.py b/jc/parsers/who.py index be8c74e7..753c53b9 100644 --- a/jc/parsers/who.py +++ b/jc/parsers/who.py @@ -272,6 +272,12 @@ def parse(data, raw=False, quiet=False): output_line['time'] = ' '.join([linedata.pop(0), linedata.pop(0)]) + # if the rest of the data is within parens, then it's the remote IP or console + if len(linedata) > 1 and ' '.join(linedata).startswith('(') and ' '.join(linedata).endswith(')'): + output_line['from'] = ' '.join(linedata)[1:-1] + raw_output.append(output_line) + continue + # if just one more field, then it's the remote IP if len(linedata) == 1: output_line['from'] = linedata[0].replace('(', '').replace(')', '')