mirror of
https://github.com/mvt-project/mvt.git
synced 2026-02-13 00:52:44 +00:00
Linted code
This commit is contained in:
@@ -57,6 +57,8 @@ class BugReportModule(MVTModule):
|
||||
if matches:
|
||||
return matches
|
||||
|
||||
return []
|
||||
|
||||
def _get_file_content(self, file_path: str) -> bytes:
|
||||
if self.zip_archive:
|
||||
handle = self.zip_archive.open(file_path)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Use of this software is governed by the MVT License 1.1 that can be found at
|
||||
# https://license.mvt.re/1.1/
|
||||
|
||||
from rich import print
|
||||
from rich import print as rich_print
|
||||
|
||||
from .updates import IndicatorsUpdates, MVTUpdates
|
||||
from .version import MVT_VERSION
|
||||
@@ -18,8 +18,8 @@ def check_updates() -> None:
|
||||
pass
|
||||
else:
|
||||
if latest_version:
|
||||
print(f"\t\t[bold]Version {latest_version} is available! "
|
||||
"Upgrade mvt![/bold]")
|
||||
rich_print(f"\t\t[bold]Version {latest_version} is available! "
|
||||
"Upgrade mvt![/bold]")
|
||||
|
||||
# Then we check for indicators files updates.
|
||||
ioc_updates = IndicatorsUpdates()
|
||||
@@ -27,8 +27,8 @@ def check_updates() -> None:
|
||||
# Before proceeding, we check if we have downloaded an indicators index.
|
||||
# If not, there's no point in proceeding with the updates check.
|
||||
if ioc_updates.get_latest_update() == 0:
|
||||
print("\t\t[bold]You have not yet downloaded any indicators, check "
|
||||
"the `download-iocs` command![/bold]")
|
||||
rich_print("\t\t[bold]You have not yet downloaded any indicators, check "
|
||||
"the `download-iocs` command![/bold]")
|
||||
return
|
||||
|
||||
# We only perform this check at a fixed frequency, in order to not
|
||||
@@ -36,8 +36,8 @@ def check_updates() -> None:
|
||||
# multiple times.
|
||||
should_check, hours = ioc_updates.should_check()
|
||||
if not should_check:
|
||||
print(f"\t\tIndicators updates checked recently, next automatic check "
|
||||
f"in {int(hours)} hours")
|
||||
rich_print(f"\t\tIndicators updates checked recently, next automatic check "
|
||||
f"in {int(hours)} hours")
|
||||
return
|
||||
|
||||
try:
|
||||
@@ -46,18 +46,18 @@ def check_updates() -> None:
|
||||
pass
|
||||
else:
|
||||
if ioc_to_update:
|
||||
print("\t\t[bold]There are updates to your indicators files! "
|
||||
"Run the `download-iocs` command to update![/bold]")
|
||||
rich_print("\t\t[bold]There are updates to your indicators files! "
|
||||
"Run the `download-iocs` command to update![/bold]")
|
||||
else:
|
||||
print("\t\tYour indicators files seem to be up to date.")
|
||||
rich_print("\t\tYour indicators files seem to be up to date.")
|
||||
|
||||
|
||||
def logo() -> None:
|
||||
print("\n")
|
||||
print("\t[bold]MVT[/bold] - Mobile Verification Toolkit")
|
||||
print("\t\thttps://mvt.re")
|
||||
print(f"\t\tVersion: {MVT_VERSION}")
|
||||
rich_print("\n")
|
||||
rich_print("\t[bold]MVT[/bold] - Mobile Verification Toolkit")
|
||||
rich_print("\t\thttps://mvt.re")
|
||||
rich_print(f"\t\tVersion: {MVT_VERSION}")
|
||||
|
||||
check_updates()
|
||||
|
||||
print("\n")
|
||||
rich_print("\n")
|
||||
|
||||
@@ -22,7 +22,7 @@ def convert_chrometime_to_datetime(timestamp: int) -> int:
|
||||
return epoch_start + delta
|
||||
|
||||
|
||||
def convert_datetime_to_iso(datetime: datetime.datetime) -> str:
|
||||
def convert_datetime_to_iso(date_time: datetime.datetime) -> str:
|
||||
"""Converts datetime to ISO string.
|
||||
|
||||
:param datetime: datetime.
|
||||
@@ -32,7 +32,7 @@ def convert_datetime_to_iso(datetime: datetime.datetime) -> str:
|
||||
|
||||
"""
|
||||
try:
|
||||
return datetime.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
return date_time.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
@@ -58,9 +58,10 @@ class ConfigurationProfiles(IOSExtraction):
|
||||
# indicator list.
|
||||
ioc = self.indicators.check_profile(result["plist"]["PayloadUUID"])
|
||||
if ioc:
|
||||
self.log.warning(f"Found a known malicious configuration profile "
|
||||
f"\"{result['plist']['PayloadDisplayName']}\" "
|
||||
f"with UUID '{result['plist']['PayloadUUID']}'.")
|
||||
self.log.warning("Found a known malicious configuration "
|
||||
"profile \"%s\" with UUID %s",
|
||||
result['plist']['PayloadDisplayName'],
|
||||
result['plist']['PayloadUUID'])
|
||||
result["matched_indicator"] = ioc
|
||||
self.detected.append(result)
|
||||
continue
|
||||
@@ -68,9 +69,10 @@ class ConfigurationProfiles(IOSExtraction):
|
||||
# Highlight suspicious configuration profiles which may be used
|
||||
# to hide notifications.
|
||||
if payload_content["PayloadType"] in ["com.apple.notificationsettings"]:
|
||||
self.log.warning(f"Found a potentially suspicious configuration profile "
|
||||
f"\"{result['plist']['PayloadDisplayName']}\" with "
|
||||
f"payload type '{payload_content['PayloadType']}'.")
|
||||
self.log.warning("Found a potentially suspicious configuration profile "
|
||||
"\"%s\" with payload type %s",
|
||||
result['plist']['PayloadDisplayName'],
|
||||
payload_content['PayloadType'])
|
||||
self.detected.append(result)
|
||||
continue
|
||||
|
||||
|
||||
@@ -116,8 +116,8 @@ class SMS(IOSExtraction):
|
||||
|
||||
alert = "ALERT: State-sponsored attackers may be targeting your iPhone"
|
||||
if message.get("text", "").startswith(alert):
|
||||
self.log.warn("Apple warning about state-sponsored attack received on the %s",
|
||||
message["isodate"])
|
||||
self.log.warning("Apple warning about state-sponsored attack received on the %s",
|
||||
message["isodate"])
|
||||
self.results.append(message)
|
||||
else:
|
||||
# Extract links from the SMS message.
|
||||
|
||||
@@ -93,8 +93,8 @@ class SMSAttachments(IOSExtraction):
|
||||
if (attachment["filename"].startswith("/var/tmp/")
|
||||
and attachment["filename"].endswith("-1")
|
||||
and attachment["direction"] == "received"):
|
||||
self.log.warn("Suspicious iMessage attachment %s on %s",
|
||||
attachment['filename'], attachment['isodate'])
|
||||
self.log.warning("Suspicious iMessage attachment %s on %s",
|
||||
attachment['filename'], attachment['isodate'])
|
||||
self.detected.append(attachment)
|
||||
|
||||
self.results.append(attachment)
|
||||
|
||||
Reference in New Issue
Block a user