From 12281585fe57a457da8aa532745533803ff8edb8 Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 6 Dec 2022 15:46:19 +0100 Subject: [PATCH 1/3] mxvmem: place script under forensics From the context the tool fits in forensics. Also it was accepted to have a python script therein. --- {mxvmem => forensics}/mxvmem | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {mxvmem => forensics}/mxvmem (100%) diff --git a/mxvmem/mxvmem b/forensics/mxvmem similarity index 100% rename from mxvmem/mxvmem rename to forensics/mxvmem From 0cf0a26f723f34dc73c68da3b0e0283c70f15a3f Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 6 Dec 2022 15:49:08 +0100 Subject: [PATCH 2/3] install.sh: Adjust for the new mxvmem location --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 04bc789..4a9d609 100755 --- a/install.sh +++ b/install.sh @@ -254,7 +254,7 @@ install_exec forensics/forensicsd "$DESTDIR$usr_sbindir/ install_data forensics/forensicsd.service "$DESTDIR$systemdunitdir/forensicsd.service" install_data forensics/forensicsd.timer "$DESTDIR$systemdunitdir/forensicsd.timer" install_data misc_etc_files/modprobe.d/ixgbe_sfp.conf "$DESTDIR$sysconfdir/modprobe.d/ixgbe_sfp.conf" -install_exec mxvmem/mxvmem "$DESTDIR$usr_bindir/mxvmem" +install_exec forensics/mxvmem "$DESTDIR$usr_bindir/mxvmem" install_data misc_systemd_units/sshd.service "$DESTDIR$systemdunitdir/sshd.service" install_data misc_systemd_units/pacbio-sshd.service "$DESTDIR$systemdunitdir/pacbio-sshd.service" From 8d9c2f5ffe3db46ed4ad0c16cfd37c9f134b9d53 Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 6 Dec 2022 15:58:17 +0100 Subject: [PATCH 3/3] mxvmem: make reading files more robust Reading logfiles containing 'strange' bytes, would yield errors like: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 3221: invalid start byte" Either switch to binary input, or escape the characters in question. Here the latter was choosen. --- forensics/mxvmem | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forensics/mxvmem b/forensics/mxvmem index 5e9b69f..7b33b36 100755 --- a/forensics/mxvmem +++ b/forensics/mxvmem @@ -110,7 +110,7 @@ class ProcBuffer(): def readfile(self, fn): lines = 0 try: - f = open(fn) + f = open(fn, errors='backslashreplace') except (FileNotFoundError, PermissionError): # do nothing return 0 for line in f: @@ -155,7 +155,7 @@ class ProcInfo(ProcInfoBase): class ProcInfoSaved(ProcInfoBase): # aka forensics ''' Read from forensics file. ''' def __init__(self, logfile): - self.file = open(logfile) + self.file = open(logfile, errors='backslashreplace') self.source = logfile def __next__(self):