From 669d001fc6e6360e69ee5728b9e47a641ae10e11 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 25 May 2022 10:40:28 +0200 Subject: [PATCH 1/2] tests: Adjust olevba expected output Before using log_helper in olevba logged a "finalization message", which is no longer required. Had forgotten to update unittests. --- tests/olevba/test_basic.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/olevba/test_basic.py b/tests/olevba/test_basic.py index 5dc4fe05..5be1269a 100644 --- a/tests/olevba/test_basic.py +++ b/tests/olevba/test_basic.py @@ -120,12 +120,9 @@ def test_xlm(self): args=[full_name, ] + ADD_ARGS, accept_nonzero_exit=True) output = json.loads(out_str) - self.assertEqual(len(output), 3) + self.assertEqual(len(output), 2) self.assertEqual(output[0]['type'], 'MetaInformation') self.assertEqual(output[0]['script_name'], 'olevba') - self.assertEqual(output[-1]['type'], 'MetaInformation') - self.assertEqual(output[-1]['n_processed'], 1) - self.assertEqual(output[-1]['return_code'], 0) result = output[1] self.assertTrue(result['json_conversion_successful']) if suffix in ('.xlsb', '.xltm', '.xlsm'): From 560b90324bdd98a82cfa8889ecdcdb99ca0236b1 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 25 May 2022 12:51:09 +0200 Subject: [PATCH 2/2] Fix olevba for py2.7 Arg "keepends" is a non-keyword-arg in python 2.7 --- oletools/olevba.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 5620f8df..2854afc3 100644 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -3112,7 +3112,7 @@ def open_slk(self, data): xlm_macro_found = False xlm_macros = [] xlm_macros.append('Formulas and XLM/Excel 4 macros extracted from SLK file:') - for line in data.splitlines(keepends=False): + for line in data.splitlines(False): if line.startswith(b'O'): # Option: "O;E" indicates a macro sheet, must appear before NN and C rows for s in line.split(b';'):