mvt/mvt/ios/modules/fs/webkit_base.py

44 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
import datetime
2021-07-30 09:40:09 +00:00
import os
from mvt.common.utils import convert_timestamp_to_iso
2021-07-16 06:05:01 +00:00
2021-08-15 11:14:18 +00:00
from ..base import IOSExtraction
2021-07-16 06:05:01 +00:00
class WebkitBase(IOSExtraction):
"""This class is a base for other WebKit-related modules."""
def check_indicators(self):
if not self.indicators:
return
2022-01-23 14:01:49 +00:00
for result in self.results:
ioc = self.indicators.check_domain(result["url"])
if ioc:
result["matched_indicator"] = ioc
self.detected.append(result)
2021-07-16 06:05:01 +00:00
2021-08-15 17:50:55 +00:00
def _process_webkit_folder(self, root_paths):
2021-08-16 08:50:35 +00:00
for found_path in self._get_fs_files_from_patterns(root_paths):
2021-07-16 06:05:01 +00:00
key = os.path.relpath(found_path, self.base_folder)
for name in os.listdir(found_path):
if not name.startswith("http"):
continue
name = name.replace("http_", "http://")
name = name.replace("https_", "https://")
url = name.split("_")[0]
2021-08-15 17:05:15 +00:00
self.results.append({
"folder": key,
"url": url,
"isodate": convert_timestamp_to_iso(datetime.datetime.utcfromtimestamp(os.stat(found_path).st_mtime)),
})