fix: [module extractor] fix invalid yara offset

pull/604/head
Terrtia 2023-08-08 11:26:16 +02:00
parent 529a24c191
commit 4dc5527c1a
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 4 additions and 4 deletions

View File

@ -106,11 +106,11 @@ def convert_byte_offset_to_string(b_content, offset):
byte_chunk = b_content[:offset + 1] byte_chunk = b_content[:offset + 1]
try: try:
string_chunk = byte_chunk.decode() string_chunk = byte_chunk.decode()
except UnicodeDecodeError as e:
logger.error(f'Yara offset converter error, {e.reason}\n{byte_chunk}\n{offset}')
string_chunk = byte_chunk
offset = len(string_chunk) - 1 offset = len(string_chunk) - 1
return offset return offset
except UnicodeDecodeError as e:
logger.error(f'Yara offset converter error, {str(e)}\n{offset}/{len(b_content)}')
return convert_byte_offset_to_string(b_content, offset)
# TODO RETRO HUNTS # TODO RETRO HUNTS