mvt/mvt/ios/modules/fs/webkit_localstorage.py

41 lines
1.5 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-06-17 20:30:46 +00:00
import logging
2021-07-16 06:05:01 +00:00
from .webkit_base import WebkitBase
WEBKIT_LOCALSTORAGE_ROOT_PATHS = [
"private/var/mobile/Containers/Data/Application/*/Library/WebKit/WebsiteData/LocalStorage/",
]
2021-11-19 14:27:51 +00:00
2021-07-16 06:05:01 +00:00
class WebkitLocalStorage(WebkitBase):
"""This module looks extracts records from WebKit LocalStorage folders,
2021-09-10 13:18:13 +00:00
and checks them against any provided list of suspicious domains.
"""
2021-07-16 06:05:01 +00:00
2022-06-17 20:30:46 +00:00
def __init__(self, file_path: str = None, target_path: str = None,
results_path: str = None, fast_mode: bool = False,
log: logging.Logger = None, results: list = []) -> None:
2022-06-16 13:18:50 +00:00
super().__init__(file_path=file_path, target_path=target_path,
results_path=results_path, fast_mode=fast_mode,
2021-07-16 06:05:01 +00:00
log=log, results=results)
2022-06-17 20:30:46 +00:00
def serialize(self, record: dict) -> None:
2021-07-16 06:05:01 +00:00
return {
"timestamp": record["isodate"],
"module": self.__class__.__name__,
"event": "webkit_local_storage",
"data": f"WebKit Local Storage folder {record['folder']} containing file for URL {record['url']}",
}
2022-06-17 20:30:46 +00:00
def run(self) -> None:
2021-08-15 17:50:55 +00:00
self._process_webkit_folder(WEBKIT_LOCALSTORAGE_ROOT_PATHS)
2021-07-16 06:05:01 +00:00
self.log.info("Extracted a total of %d records from WebKit Local Storages",
len(self.results))