Skip to content

Commit

Permalink
Autofix for ruff (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
roaree authored Jan 14, 2025
1 parent 2aa76c8 commit 6e230bd
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/mvt/android/artifacts/dumpsys_appops.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def check_indicators(self) -> None:
and perm["access"] == "allow"
):
self.log.info(
"Package %s with REQUEST_INSTALL_PACKAGES " "permission",
"Package %s with REQUEST_INSTALL_PACKAGES permission",
result["package_name"],
)

Expand Down
3 changes: 1 addition & 2 deletions src/mvt/android/artifacts/dumpsys_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def check_indicators(self) -> None:
for result in self.results:
if result["package_name"] in ROOT_PACKAGES:
self.log.warning(
"Found an installed package related to "
'rooting/jailbreaking: "%s"',
'Found an installed package related to rooting/jailbreaking: "%s"',
result["package_name"],
)
self.detected.append(result)
Expand Down
3 changes: 1 addition & 2 deletions src/mvt/android/modules/adb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ def _generate_backup(self, package_name: str) -> bytes:

if not header["backup"]:
self.log.error(
"Extracting SMS via Android backup failed. "
"No valid backup data found."
"Extracting SMS via Android backup failed. No valid backup data found."
)
return None

Expand Down
3 changes: 1 addition & 2 deletions src/mvt/android/modules/adb/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def check_indicators(self) -> None:
for result in self.results:
if result["package_name"] in ROOT_PACKAGES:
self.log.warning(
"Found an installed package related to "
'rooting/jailbreaking: "%s"',
'Found an installed package related to rooting/jailbreaking: "%s"',
result["package_name"],
)
self.detected.append(result)
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/android/modules/adb/sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def serialize(self, record: dict) -> Union[dict, list]:
"timestamp": record["isodate"],
"module": self.__class__.__name__,
"event": f"sms_{record['direction']}",
"data": f"{record.get('address', 'unknown source')}: \"{body}\"",
"data": f'{record.get("address", "unknown source")}: "{body}"',
}

def check_indicators(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions src/mvt/android/modules/androidqf/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def check_indicators(self) -> None:
for result in self.results:
if result["name"] in ROOT_PACKAGES:
self.log.warning(
"Found an installed package related to "
'rooting/jailbreaking: "%s"',
'Found an installed package related to rooting/jailbreaking: "%s"',
result["name"],
)
self.detected.append(result)
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _setup_logging(self):
os.path.join(self.results_path, "command.log")
)
formatter = logging.Formatter(
"%(asctime)s - %(name)s - " "%(levelname)s - %(message)s"
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(formatter)
Expand Down
3 changes: 1 addition & 2 deletions src/mvt/common/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ def check_url(self, url: str) -> Union[dict, None]:
for ioc in self.get_iocs("urls"):
if ioc["value"] == url:
self.log.warning(
"Found a known suspicious URL %s "
'matching indicator "%s" from "%s"',
'Found a known suspicious URL %s matching indicator "%s" from "%s"',
url,
ioc["value"],
ioc["name"],
Expand Down
7 changes: 3 additions & 4 deletions src/mvt/ios/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def decrypt_backup(ctx, destination, password, key_file, hashes, backup_path):
if key_file:
if MVT_IOS_BACKUP_PASSWORD in os.environ:
log.info(
"Ignoring %s environment variable, using --key-file" "'%s' instead",
"Ignoring %s environment variable, using --key-file'%s' instead",
MVT_IOS_BACKUP_PASSWORD,
key_file,
)
Expand All @@ -114,7 +114,7 @@ def decrypt_backup(ctx, destination, password, key_file, hashes, backup_path):

if MVT_IOS_BACKUP_PASSWORD in os.environ:
log.info(
"Ignoring %s environment variable, using --password" "argument instead",
"Ignoring %s environment variable, using --passwordargument instead",
MVT_IOS_BACKUP_PASSWORD,
)

Expand Down Expand Up @@ -168,8 +168,7 @@ def extract_key(password, key_file, backup_path):

if MVT_IOS_BACKUP_PASSWORD in os.environ:
log.info(
"Ignoring %s environment variable, using --password "
"argument instead",
"Ignoring %s environment variable, using --password argument instead",
MVT_IOS_BACKUP_PASSWORD,
)
elif MVT_IOS_BACKUP_PASSWORD in os.environ:
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/ios/modules/backup/backup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run(self) -> None:
info_path = os.path.join(self.target_path, "Info.plist")
if not os.path.exists(info_path):
raise DatabaseNotFoundError(
"No Info.plist at backup path, unable to extract device " "information"
"No Info.plist at backup path, unable to extract device information"
)

with open(info_path, "rb") as handle:
Expand Down
3 changes: 1 addition & 2 deletions src/mvt/ios/modules/backup/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def check_indicators(self) -> None:
ioc = self.indicators.check_url(part)
if ioc:
self.log.warning(
'Found mention of domain "%s" in a backup file with '
"path: %s",
'Found mention of domain "%s" in a backup file with path: %s',
ioc["value"],
rel_path,
)
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/ios/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _recover_sqlite_db_if_needed(

if not shutil.which("sqlite3"):
raise DatabaseCorruptedError(
"failed to recover without sqlite3 binary: please install " "sqlite3!"
"failed to recover without sqlite3 binary: please install sqlite3!"
)
if '"' in file_path:
raise DatabaseCorruptedError(
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/ios/modules/mixed/sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(

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 = f'{record["service"]}: {record["guid"]} "{text}" from {record["phone_number"]} ({record["account"]})'
records = [
{
"timestamp": record["isodate"],
Expand Down
2 changes: 1 addition & 1 deletion src/mvt/ios/modules/mixed/webkit_session_resource_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def check_indicators(self) -> None:
redirect_path += ", ".join(source_domains)
redirect_path += " -> "

redirect_path += f"ORIGIN: \"{entry['origin']}\""
redirect_path += f'ORIGIN: "{entry["origin"]}"'

if len(destination_domains) > 0:
redirect_path += " -> "
Expand Down

0 comments on commit 6e230bd

Please sign in to comment.