Skip to content

Commit

Permalink
fix: Push code changes related to deps upgrade...
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Jul 31, 2023
1 parent 54d3a97 commit dc315f3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pymisp/tools/emailobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from pathlib import Path
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.deencapsulate import DeEncapsulator # type: ignore
from oletools.common.codepages import codepage2codec # type: ignore
Expand Down Expand Up @@ -111,8 +113,11 @@ def _extract_msg_objects(self, msg_obj: MessageBase) -> Tuple[EmailMessage, Dict
"cte": "base64"}
if msg_obj.htmlBody is not None:
try:
_html_encoding_raw = msg_obj.props['3FDE0003'].value
_html_encoding = codepage2codec(_html_encoding_raw)
if isinstance(msg_obj.props['3FDE0003'], FixedLengthProp):
_html_encoding_raw = msg_obj.props['3FDE0003'].value
_html_encoding = codepage2codec(_html_encoding_raw)
else:
_html_encoding = msg_obj.stringEncoding
except KeyError:
_html_encoding = msg_obj.stringEncoding
body['html'] = {'obj': msg_obj.htmlBody.decode(),
Expand Down

0 comments on commit dc315f3

Please sign in to comment.