fix: Push code changes related to deps upgrade...

pull/1035/head
Raphaël Vinot 2023-07-31 11:59:00 +02:00
parent 54d3a97643
commit dc315f3f5c
1 changed files with 8 additions and 3 deletions

View File

@ -11,7 +11,9 @@ from io import BytesIO
from pathlib import Path from pathlib import Path
from typing import Union, List, Tuple, Dict, cast, Any, Optional from typing import Union, List, Tuple, Dict, cast, Any, Optional
from extract_msg import openMsg, MessageBase from extract_msg import openMsg
from extract_msg.msg_classes import MessageBase
from extract_msg.properties import FixedLengthProp
from RTFDE.exceptions import MalformedEncapsulatedRtf, NotEncapsulatedRtf # type: ignore from RTFDE.exceptions import MalformedEncapsulatedRtf, NotEncapsulatedRtf # type: ignore
from RTFDE.deencapsulate import DeEncapsulator # type: ignore from RTFDE.deencapsulate import DeEncapsulator # type: ignore
from oletools.common.codepages import codepage2codec # type: ignore from oletools.common.codepages import codepage2codec # type: ignore
@ -111,8 +113,11 @@ class EMailObject(AbstractMISPObjectGenerator):
"cte": "base64"} "cte": "base64"}
if msg_obj.htmlBody is not None: if msg_obj.htmlBody is not None:
try: try:
_html_encoding_raw = msg_obj.props['3FDE0003'].value if isinstance(msg_obj.props['3FDE0003'], FixedLengthProp):
_html_encoding = codepage2codec(_html_encoding_raw) _html_encoding_raw = msg_obj.props['3FDE0003'].value
_html_encoding = codepage2codec(_html_encoding_raw)
else:
_html_encoding = msg_obj.stringEncoding
except KeyError: except KeyError:
_html_encoding = msg_obj.stringEncoding _html_encoding = msg_obj.stringEncoding
body['html'] = {'obj': msg_obj.htmlBody.decode(), body['html'] = {'obj': msg_obj.htmlBody.decode(),