From 2838bac63fb6e077441e66623794b80df8afca03 Mon Sep 17 00:00:00 2001 From: Rory Flynn <75283103+roaree@users.noreply.github.com> Date: Wed, 3 Jan 2024 18:55:32 +0100 Subject: [PATCH] Circular reference in SMS module serialization (#444) * Fix circular reference in SMS module serialization * Modify SMS test artifact to include date_read --- mvt/ios/modules/mixed/sms.py | 6 +++--- .../3d0d7e5fb2ce288813306e4d4636395e047a3d28 | Bin 28672 -> 28672 bytes tests/ios_backup/test_sms.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mvt/ios/modules/mixed/sms.py b/mvt/ios/modules/mixed/sms.py index eecc1c4..6491343 100644 --- a/mvt/ios/modules/mixed/sms.py +++ b/mvt/ios/modules/mixed/sms.py @@ -44,7 +44,7 @@ class SMS(IOSExtraction): def serialize(self, record: dict) -> Union[dict, list]: text = record["text"].replace("\n", "\\n") sms_data = f"{record['service']}: {record['guid']} \"{text}\" from {record['phone_number']} ({record['account']})" - sms_data = [ + records = [ { "timestamp": record["isodate"], "module": self.__class__.__name__, @@ -54,7 +54,7 @@ class SMS(IOSExtraction): ] # If the message was read, we add an extra event. if record["isodate_read"]: - sms_data.append( + records.append( { "timestamp": record["isodate_read"], "module": self.__class__.__name__, @@ -62,7 +62,7 @@ class SMS(IOSExtraction): "data": sms_data, } ) - return sms_data + return records def check_indicators(self) -> None: for message in self.results: diff --git a/tests/artifacts/ios_backup/3d/3d0d7e5fb2ce288813306e4d4636395e047a3d28 b/tests/artifacts/ios_backup/3d/3d0d7e5fb2ce288813306e4d4636395e047a3d28 index b067ce7ca5c64b376441171a3c563969d34ae09f..f18450e308530d951725cbfc5a43da36d9da0470 100644 GIT binary patch delta 67 zcmZp8z}WDBae_1>=R_H2M$U~1%lujV82J4*3ktaKi#F;rdozUQa`198Ffed%fCx6W V$=UH!IXJW*)t&X+ldvd3002p)5jFq- delta 58 zcmZp8z}WDBae_1>$3z)tMvjdM%luiw82H0B3kvw~i#Dn=dozUQa`198Ffed%fCx5* M$;t6k7bOS)0KshyX#fBK diff --git a/tests/ios_backup/test_sms.py b/tests/ios_backup/test_sms.py index 84ac0b5..243f630 100644 --- a/tests/ios_backup/test_sms.py +++ b/tests/ios_backup/test_sms.py @@ -17,7 +17,7 @@ class TestSMSModule: m = SMS(target_path=get_ios_backup_folder()) run_module(m) assert len(m.results) == 1 - assert len(m.timeline) == 1 + assert len(m.timeline) == 2 assert len(m.detected) == 0 def test_detection(self, indicator_file):