mvt/mvt/android/modules/backup/sms.py

37 lines
1.4 KiB
Python
Raw Normal View History

2021-07-16 06:05:01 +00:00
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 Claudio Guarnieri.
# Use of this software is governed by the MVT License 1.1 that can be found at
# https://license.mvt.re/1.1/
2021-07-16 06:05:01 +00:00
2022-03-04 09:10:56 +00:00
from mvt.android.modules.backup.base import BackupExtraction
from mvt.android.parsers.backup import parse_sms_file
2022-03-10 10:33:54 +00:00
from mvt.common.utils import check_for_links
2021-07-30 09:40:09 +00:00
2021-07-16 06:05:01 +00:00
2022-03-04 09:10:56 +00:00
class SMS(BackupExtraction):
2021-07-16 06:05:01 +00:00
def __init__(self, file_path=None, base_folder=None, output_folder=None,
fast_mode=False, log=None, results=[]):
super().__init__(file_path=file_path, base_folder=base_folder,
output_folder=output_folder, fast_mode=fast_mode,
log=log, results=results)
2022-03-04 09:10:56 +00:00
self.results = []
2021-07-16 06:05:01 +00:00
def check_indicators(self):
if not self.indicators:
return
for message in self.results:
2021-11-19 14:27:51 +00:00
if "body" not in message:
2021-07-16 06:05:01 +00:00
continue
2022-03-04 09:10:56 +00:00
if self.indicators.check_domains(message["links"]):
2021-07-16 06:05:01 +00:00
self.detected.append(message)
def run(self):
2022-03-04 09:10:56 +00:00
for file in self._get_files_by_pattern("apps/com.android.providers.telephony/d_f/*_sms_backup"):
self.log.info("Processing SMS backup file at %s", file)
data = self._get_file_content(file)
self.results.extend(parse_sms_file(data))
2021-07-16 06:05:01 +00:00
self.log.info("Extracted a total of %d SMS messages containing links",
len(self.results))