From 04d3183115cb4b930f6b9fb57e18421fbe3f9376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 8 May 2018 11:02:32 +0200 Subject: [PATCH] fix: Properly get and decode the body of the email --- pymisp/tools/emailobject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymisp/tools/emailobject.py b/pymisp/tools/emailobject.py index 88e8474..3a3d34b 100644 --- a/pymisp/tools/emailobject.py +++ b/pymisp/tools/emailobject.py @@ -40,8 +40,8 @@ class EMailObject(AbstractMISPObjectGenerator): return to_return def generate_attributes(self): - if self.__email.get_body(): - self.add_attribute('email-body', value=self.__email.get_body().as_string()) + if self.__email.get_body(preferencelist=('html', 'plain')): + self.add_attribute('email-body', value=self.__email.get_body(preferencelist=('html', 'plain')).get_payload(decode=True).decode()) if 'Reply-To' in self.__email: self.add_attribute('reply-to', value=self.__email['Reply-To']) if 'Message-ID' in self.__email: