diff --git a/mvt/android/modules/adb/whatsapp.py b/mvt/android/modules/adb/whatsapp.py index 6d369d6..f8eacbd 100644 --- a/mvt/android/modules/adb/whatsapp.py +++ b/mvt/android/modules/adb/whatsapp.py @@ -6,6 +6,7 @@ import os import sqlite3 import logging +import base64 from .base import AndroidExtraction from mvt.common.utils import convert_timestamp_to_iso, check_for_links @@ -69,6 +70,8 @@ class Whatsapp(AndroidExtraction): # If we find links in the messages or if they are empty we add them to the list. if check_for_links(message["data"]) or message["data"].strip() == "": + if (message.get('thumb_image') is not None): + message['thumb_image'] = base64.b64encode(message['thumb_image']) messages.append(message) cur.close() diff --git a/mvt/common/module.py b/mvt/common/module.py index 7d9a56d..ebb8a27 100644 --- a/mvt/common/module.py +++ b/mvt/common/module.py @@ -89,7 +89,10 @@ class MVTModule(object): results_file_name = f"{name}.json" results_json_path = os.path.join(self.output_folder, results_file_name) with open(results_json_path, "w") as handle: - json.dump(self.results, handle, indent=4) + try: + json.dump(self.results, handle, indent=4) + except Exception as e: + self.log.error(e) if self.detected: detected_file_name = f"{name}_detected.json"