ruff syntax fix

This commit is contained in:
Janik Besendorf
2025-08-05 15:21:33 +02:00
parent 3b144b263b
commit f12cf7dec5
3 changed files with 56 additions and 30 deletions

View File

@@ -59,14 +59,23 @@ CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
# Main
# ==============================================================================
@click.group(invoke_without_command=False)
@click.option("--disable-update-check", is_flag=True, help=HELP_MSG_DISABLE_UPDATE_CHECK)
@click.option("--disable-indicator-update-check", is_flag=True, help=HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK)
@click.option(
"--disable-update-check", is_flag=True, help=HELP_MSG_DISABLE_UPDATE_CHECK
)
@click.option(
"--disable-indicator-update-check",
is_flag=True,
help=HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK,
)
@click.pass_context
def cli(ctx, disable_update_check, disable_indicator_update_check):
ctx.ensure_object(dict)
ctx.obj['disable_version_check'] = disable_update_check
ctx.obj['disable_indicator_check'] = disable_indicator_update_check
logo(disable_version_check=disable_update_check, disable_indicator_check=disable_indicator_update_check)
ctx.obj["disable_version_check"] = disable_update_check
ctx.obj["disable_indicator_check"] = disable_indicator_update_check
logo(
disable_version_check=disable_update_check,
disable_indicator_check=disable_indicator_update_check,
)
# ==============================================================================
@@ -174,8 +183,8 @@ def check_adb(
module_name=module,
serial=serial,
module_options=module_options,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -222,8 +231,8 @@ def check_bugreport(ctx, iocs, output, list_modules, module, verbose, bugreport_
ioc_files=iocs,
module_name=module,
hashes=True,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -286,8 +295,8 @@ def check_backup(
"interactive": not non_interactive,
"backup_password": cli_load_android_backup_password(log, backup_password),
},
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -352,8 +361,8 @@ def check_androidqf(
"interactive": not non_interactive,
"backup_password": cli_load_android_backup_password(log, backup_password),
},
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -392,8 +401,8 @@ def check_iocs(ctx, iocs, list_modules, module, folder):
target_path=folder,
ioc_files=iocs,
module_name=module,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
cmd.modules = BACKUP_MODULES + ADB_MODULES + BUGREPORT_MODULES

View File

@@ -12,7 +12,9 @@ from .updates import IndicatorsUpdates, MVTUpdates
from .version import MVT_VERSION
def check_updates(disable_version_check: bool = False, disable_indicator_check: bool = False) -> None:
def check_updates(
disable_version_check: bool = False, disable_indicator_check: bool = False
) -> None:
log = logging.getLogger("mvt")
# First we check for MVT version updates.
@@ -26,7 +28,9 @@ def check_updates(disable_version_check: bool = False, disable_indicator_check:
"You may be working offline. Please update MVT regularly."
)
except Exception as e:
log.error("Error encountered when trying to check latest MVT version: %s", e)
log.error(
"Error encountered when trying to check latest MVT version: %s", e
)
else:
if latest_version:
rich_print(
@@ -66,7 +70,9 @@ def check_updates(disable_version_check: bool = False, disable_indicator_check:
"You may be working offline. Please update MVT indicators regularly."
)
except Exception as e:
log.error("Error encountered when trying to check latest MVT indicators: %s", e)
log.error(
"Error encountered when trying to check latest MVT indicators: %s", e
)
else:
if ioc_to_update:
rich_print(
@@ -77,7 +83,9 @@ def check_updates(disable_version_check: bool = False, disable_indicator_check:
rich_print("\t\tYour indicators files seem to be up to date.")
def logo(disable_version_check: bool = False, disable_indicator_check: bool = False) -> None:
def logo(
disable_version_check: bool = False, disable_indicator_check: bool = False
) -> None:
rich_print("\n")
rich_print("\t[bold]MVT[/bold] - Mobile Verification Toolkit")
rich_print("\t\thttps://mvt.re")

View File

@@ -59,14 +59,23 @@ CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
# Main
# ==============================================================================
@click.group(invoke_without_command=False)
@click.option("--disable-update-check", is_flag=True, help=HELP_MSG_DISABLE_UPDATE_CHECK)
@click.option("--disable-indicator-update-check", is_flag=True, help=HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK)
@click.option(
"--disable-update-check", is_flag=True, help=HELP_MSG_DISABLE_UPDATE_CHECK
)
@click.option(
"--disable-indicator-update-check",
is_flag=True,
help=HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK,
)
@click.pass_context
def cli(ctx, disable_update_check, disable_indicator_update_check):
ctx.ensure_object(dict)
ctx.obj['disable_version_check'] = disable_update_check
ctx.obj['disable_indicator_check'] = disable_indicator_update_check
logo(disable_version_check=disable_update_check, disable_indicator_check=disable_indicator_update_check)
ctx.obj["disable_version_check"] = disable_update_check
ctx.obj["disable_indicator_check"] = disable_indicator_update_check
logo(
disable_version_check=disable_update_check,
disable_indicator_check=disable_indicator_update_check,
)
# ==============================================================================
@@ -227,8 +236,8 @@ def check_backup(
module_name=module,
module_options=module_options,
hashes=hashes,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -276,8 +285,8 @@ def check_fs(ctx, iocs, output, fast, list_modules, module, hashes, verbose, dum
module_name=module,
module_options=module_options,
hashes=hashes,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
if list_modules:
@@ -316,8 +325,8 @@ def check_iocs(ctx, iocs, list_modules, module, folder):
target_path=folder,
ioc_files=iocs,
module_name=module,
disable_version_check=ctx.obj.get('disable_version_check', False),
disable_indicator_check=ctx.obj.get('disable_indicator_check', False),
disable_version_check=ctx.obj.get("disable_version_check", False),
disable_indicator_check=ctx.obj.get("disable_indicator_check", False),
)
cmd.modules = BACKUP_MODULES + FS_MODULES + MIXED_MODULES