From bd7aa979bd847a516155bb896d6453a961f63116 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 8 Aug 2023 10:36:58 +0200 Subject: [PATCH] chg: [module extrator] add debug --- bin/lib/module_extractor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/lib/module_extractor.py b/bin/lib/module_extractor.py index d4ea6c78..54e4d3ab 100755 --- a/bin/lib/module_extractor.py +++ b/bin/lib/module_extractor.py @@ -104,7 +104,11 @@ def _get_word_regex(word): def convert_byte_offset_to_string(b_content, offset): byte_chunk = b_content[:offset + 1] - string_chunk = byte_chunk.decode() + try: + string_chunk = byte_chunk.decode() + except UnicodeDecodeError as e: + logger.error(f'Yara offset coverter error, {e.reason}\n{b_content}\n{offset}') + string_chunk = b_content offset = len(string_chunk) - 1 return offset