mirror of https://github.com/CIRCL/AIL-framework
fix: [module extractor] fix invalid yara offset
parent
529a24c191
commit
4dc5527c1a
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue