mirror of
https://github.com/mvt-project/mvt
synced 2025-11-13 01:37:36 +01:00
Compare commits
7 Commits
dependabot
...
update-che
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcc720fd13 | ||
|
|
7fe66e8d5a | ||
|
|
a41b772e9e | ||
|
|
f12cf7dec5 | ||
|
|
3b144b263b | ||
|
|
ab9abfaded | ||
|
|
ef2ffb0dda |
@@ -31,6 +31,8 @@ from mvt.common.help import (
|
|||||||
HELP_MSG_HASHES,
|
HELP_MSG_HASHES,
|
||||||
HELP_MSG_CHECK_IOCS,
|
HELP_MSG_CHECK_IOCS,
|
||||||
HELP_MSG_STIX2,
|
HELP_MSG_STIX2,
|
||||||
|
HELP_MSG_DISABLE_UPDATE_CHECK,
|
||||||
|
HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK,
|
||||||
)
|
)
|
||||||
from mvt.common.logo import logo
|
from mvt.common.logo import logo
|
||||||
from mvt.common.updates import IndicatorsUpdates
|
from mvt.common.updates import IndicatorsUpdates
|
||||||
@@ -53,12 +55,37 @@ log = logging.getLogger("mvt")
|
|||||||
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
||||||
|
|
||||||
|
|
||||||
|
def _get_disable_flags(ctx):
|
||||||
|
"""Helper function to safely get disable flags from context."""
|
||||||
|
if ctx.obj is None:
|
||||||
|
return False, False
|
||||||
|
return (
|
||||||
|
ctx.obj.get("disable_version_check", False),
|
||||||
|
ctx.obj.get("disable_indicator_check", False),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Main
|
# Main
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@click.group(invoke_without_command=False)
|
@click.group(invoke_without_command=False)
|
||||||
def cli():
|
@click.option(
|
||||||
logo()
|
"--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,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@@ -166,6 +193,8 @@ def check_adb(
|
|||||||
module_name=module,
|
module_name=module,
|
||||||
serial=serial,
|
serial=serial,
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -212,6 +241,8 @@ def check_bugreport(ctx, iocs, output, list_modules, module, verbose, bugreport_
|
|||||||
ioc_files=iocs,
|
ioc_files=iocs,
|
||||||
module_name=module,
|
module_name=module,
|
||||||
hashes=True,
|
hashes=True,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -274,6 +305,8 @@ def check_backup(
|
|||||||
"interactive": not non_interactive,
|
"interactive": not non_interactive,
|
||||||
"backup_password": cli_load_android_backup_password(log, backup_password),
|
"backup_password": cli_load_android_backup_password(log, backup_password),
|
||||||
},
|
},
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -338,6 +371,8 @@ def check_androidqf(
|
|||||||
"interactive": not non_interactive,
|
"interactive": not non_interactive,
|
||||||
"backup_password": cli_load_android_backup_password(log, backup_password),
|
"backup_password": cli_load_android_backup_password(log, backup_password),
|
||||||
},
|
},
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -372,7 +407,13 @@ def check_androidqf(
|
|||||||
@click.argument("FOLDER", type=click.Path(exists=True))
|
@click.argument("FOLDER", type=click.Path(exists=True))
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def check_iocs(ctx, iocs, list_modules, module, folder):
|
def check_iocs(ctx, iocs, list_modules, module, folder):
|
||||||
cmd = CmdCheckIOCS(target_path=folder, ioc_files=iocs, module_name=module)
|
cmd = CmdCheckIOCS(
|
||||||
|
target_path=folder,
|
||||||
|
ioc_files=iocs,
|
||||||
|
module_name=module,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
|
)
|
||||||
cmd.modules = BACKUP_MODULES + ADB_MODULES + BUGREPORT_MODULES
|
cmd.modules = BACKUP_MODULES + ADB_MODULES + BUGREPORT_MODULES
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class CmdAndroidCheckADB(Command):
|
|||||||
module_name: Optional[str] = None,
|
module_name: Optional[str] = None,
|
||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -31,6 +33,8 @@ class CmdAndroidCheckADB(Command):
|
|||||||
serial=serial,
|
serial=serial,
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-adb"
|
self.name = "check-adb"
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ class CmdAndroidCheckAndroidQF(Command):
|
|||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -36,6 +38,8 @@ class CmdAndroidCheckAndroidQF(Command):
|
|||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-androidqf"
|
self.name = "check-androidqf"
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ class CmdAndroidCheckBackup(Command):
|
|||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -46,6 +48,8 @@ class CmdAndroidCheckBackup(Command):
|
|||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-backup"
|
self.name = "check-backup"
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ class CmdAndroidCheckBugreport(Command):
|
|||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -37,6 +39,8 @@ class CmdAndroidCheckBugreport(Command):
|
|||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-bugreport"
|
self.name = "check-bugreport"
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class CmdCheckIOCS(Command):
|
|||||||
module_name: Optional[str] = None,
|
module_name: Optional[str] = None,
|
||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -31,6 +33,8 @@ class CmdCheckIOCS(Command):
|
|||||||
serial=serial,
|
serial=serial,
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-iocs"
|
self.name = "check-iocs"
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ class Command:
|
|||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
log: logging.Logger = logging.getLogger(__name__),
|
log: logging.Logger = logging.getLogger(__name__),
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.name = ""
|
self.name = ""
|
||||||
self.modules = []
|
self.modules = []
|
||||||
@@ -42,6 +44,8 @@ class Command:
|
|||||||
self.module_name = module_name
|
self.module_name = module_name
|
||||||
self.serial = serial
|
self.serial = serial
|
||||||
self.log = log
|
self.log = log
|
||||||
|
self.disable_version_check = disable_version_check
|
||||||
|
self.disable_indicator_check = disable_indicator_check
|
||||||
|
|
||||||
# This dictionary can contain options that will be passed down from
|
# This dictionary can contain options that will be passed down from
|
||||||
# the Command to all modules. This can for example be used to pass
|
# the Command to all modules. This can for example be used to pass
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ HELP_MSG_HASHES = "Generate hashes of all the files analyzed"
|
|||||||
HELP_MSG_VERBOSE = "Verbose mode"
|
HELP_MSG_VERBOSE = "Verbose mode"
|
||||||
HELP_MSG_CHECK_IOCS = "Compare stored JSON results to provided indicators"
|
HELP_MSG_CHECK_IOCS = "Compare stored JSON results to provided indicators"
|
||||||
HELP_MSG_STIX2 = "Download public STIX2 indicators"
|
HELP_MSG_STIX2 = "Download public STIX2 indicators"
|
||||||
|
HELP_MSG_DISABLE_UPDATE_CHECK = "Disable MVT version update check"
|
||||||
|
HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK = "Disable indicators update check"
|
||||||
|
|
||||||
# IOS Specific
|
# IOS Specific
|
||||||
HELP_MSG_DECRYPT_BACKUP = "Decrypt an encrypted iTunes backup"
|
HELP_MSG_DECRYPT_BACKUP = "Decrypt an encrypted iTunes backup"
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ from .updates import IndicatorsUpdates, MVTUpdates
|
|||||||
from .version import MVT_VERSION
|
from .version import MVT_VERSION
|
||||||
|
|
||||||
|
|
||||||
def check_updates() -> None:
|
def check_updates(
|
||||||
|
disable_version_check: bool = False, disable_indicator_check: bool = False
|
||||||
|
) -> None:
|
||||||
log = logging.getLogger("mvt")
|
log = logging.getLogger("mvt")
|
||||||
|
|
||||||
# First we check for MVT version updates.
|
# First we check for MVT version updates.
|
||||||
|
if not disable_version_check:
|
||||||
try:
|
try:
|
||||||
mvt_updates = MVTUpdates()
|
mvt_updates = MVTUpdates()
|
||||||
latest_version = mvt_updates.check()
|
latest_version = mvt_updates.check()
|
||||||
@@ -24,7 +28,9 @@ def check_updates() -> None:
|
|||||||
"You may be working offline. Please update MVT regularly."
|
"You may be working offline. Please update MVT regularly."
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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:
|
else:
|
||||||
if latest_version:
|
if latest_version:
|
||||||
rich_print(
|
rich_print(
|
||||||
@@ -33,6 +39,7 @@ def check_updates() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Then we check for indicators files updates.
|
# Then we check for indicators files updates.
|
||||||
|
if not disable_indicator_check:
|
||||||
ioc_updates = IndicatorsUpdates()
|
ioc_updates = IndicatorsUpdates()
|
||||||
|
|
||||||
# Before proceeding, we check if we have downloaded an indicators index.
|
# Before proceeding, we check if we have downloaded an indicators index.
|
||||||
@@ -63,7 +70,9 @@ def check_updates() -> None:
|
|||||||
"You may be working offline. Please update MVT indicators regularly."
|
"You may be working offline. Please update MVT indicators regularly."
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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:
|
else:
|
||||||
if ioc_to_update:
|
if ioc_to_update:
|
||||||
rich_print(
|
rich_print(
|
||||||
@@ -74,12 +83,14 @@ def check_updates() -> None:
|
|||||||
rich_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:
|
def logo(
|
||||||
|
disable_version_check: bool = False, disable_indicator_check: bool = False
|
||||||
|
) -> None:
|
||||||
rich_print("\n")
|
rich_print("\n")
|
||||||
rich_print("\t[bold]MVT[/bold] - Mobile Verification Toolkit")
|
rich_print("\t[bold]MVT[/bold] - Mobile Verification Toolkit")
|
||||||
rich_print("\t\thttps://mvt.re")
|
rich_print("\t\thttps://mvt.re")
|
||||||
rich_print(f"\t\tVersion: {MVT_VERSION}")
|
rich_print(f"\t\tVersion: {MVT_VERSION}")
|
||||||
|
|
||||||
check_updates()
|
check_updates(disable_version_check, disable_indicator_check)
|
||||||
|
|
||||||
rich_print("\n")
|
rich_print("\n")
|
||||||
|
|||||||
@@ -24,7 +24,11 @@ INDICATORS_CHECK_FREQUENCY = 12
|
|||||||
|
|
||||||
class MVTUpdates:
|
class MVTUpdates:
|
||||||
def check(self) -> str:
|
def check(self) -> str:
|
||||||
res = requests.get(settings.PYPI_UPDATE_URL, timeout=15)
|
try:
|
||||||
|
res = requests.get(settings.PYPI_UPDATE_URL, timeout=5)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
log.error("Failed to check for updates, skipping updates: %s", e)
|
||||||
|
return ""
|
||||||
data = res.json()
|
data = res.json()
|
||||||
latest_version = data.get("info", {}).get("version", "")
|
latest_version = data.get("info", {}).get("version", "")
|
||||||
|
|
||||||
@@ -93,7 +97,12 @@ class IndicatorsUpdates:
|
|||||||
url = self.github_raw_url.format(
|
url = self.github_raw_url.format(
|
||||||
self.index_owner, self.index_repo, self.index_branch, self.index_path
|
self.index_owner, self.index_repo, self.index_branch, self.index_path
|
||||||
)
|
)
|
||||||
res = requests.get(url, timeout=15)
|
try:
|
||||||
|
res = requests.get(url, timeout=5)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
log.error("Failed to retrieve indicators index from %s: %s", url, e)
|
||||||
|
return None
|
||||||
|
|
||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
log.error(
|
log.error(
|
||||||
"Failed to retrieve indicators index located at %s (error %d)",
|
"Failed to retrieve indicators index located at %s (error %d)",
|
||||||
@@ -105,7 +114,12 @@ class IndicatorsUpdates:
|
|||||||
return yaml.safe_load(res.content)
|
return yaml.safe_load(res.content)
|
||||||
|
|
||||||
def download_remote_ioc(self, ioc_url: str) -> Optional[str]:
|
def download_remote_ioc(self, ioc_url: str) -> Optional[str]:
|
||||||
|
try:
|
||||||
res = requests.get(ioc_url, timeout=15)
|
res = requests.get(ioc_url, timeout=15)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
log.error("Failed to download indicators file from %s: %s", ioc_url, e)
|
||||||
|
return None
|
||||||
|
|
||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
log.error(
|
log.error(
|
||||||
"Failed to download indicators file from %s (error %d)",
|
"Failed to download indicators file from %s (error %d)",
|
||||||
@@ -171,7 +185,12 @@ class IndicatorsUpdates:
|
|||||||
file_commit_url = (
|
file_commit_url = (
|
||||||
f"https://api.github.com/repos/{owner}/{repo}/commits?path={path}"
|
f"https://api.github.com/repos/{owner}/{repo}/commits?path={path}"
|
||||||
)
|
)
|
||||||
res = requests.get(file_commit_url, timeout=15)
|
try:
|
||||||
|
res = requests.get(file_commit_url, timeout=5)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
log.error("Failed to get details about file %s: %s", file_commit_url, e)
|
||||||
|
return -1
|
||||||
|
|
||||||
if res.status_code != 200:
|
if res.status_code != 200:
|
||||||
log.error(
|
log.error(
|
||||||
"Failed to get details about file %s (error %d)",
|
"Failed to get details about file %s (error %d)",
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ from mvt.common.help import (
|
|||||||
HELP_MSG_CHECK_IOCS,
|
HELP_MSG_CHECK_IOCS,
|
||||||
HELP_MSG_STIX2,
|
HELP_MSG_STIX2,
|
||||||
HELP_MSG_CHECK_IOS_BACKUP,
|
HELP_MSG_CHECK_IOS_BACKUP,
|
||||||
|
HELP_MSG_DISABLE_UPDATE_CHECK,
|
||||||
|
HELP_MSG_DISABLE_INDICATOR_UPDATE_CHECK,
|
||||||
)
|
)
|
||||||
from .cmd_check_backup import CmdIOSCheckBackup
|
from .cmd_check_backup import CmdIOSCheckBackup
|
||||||
from .cmd_check_fs import CmdIOSCheckFS
|
from .cmd_check_fs import CmdIOSCheckFS
|
||||||
@@ -53,12 +55,37 @@ MVT_IOS_BACKUP_PASSWORD = "MVT_IOS_BACKUP_PASSWORD"
|
|||||||
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
||||||
|
|
||||||
|
|
||||||
|
def _get_disable_flags(ctx):
|
||||||
|
"""Helper function to safely get disable flags from context."""
|
||||||
|
if ctx.obj is None:
|
||||||
|
return False, False
|
||||||
|
return (
|
||||||
|
ctx.obj.get("disable_version_check", False),
|
||||||
|
ctx.obj.get("disable_indicator_check", False),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Main
|
# Main
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@click.group(invoke_without_command=False)
|
@click.group(invoke_without_command=False)
|
||||||
def cli():
|
@click.option(
|
||||||
logo()
|
"--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,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@@ -219,6 +246,8 @@ def check_backup(
|
|||||||
module_name=module,
|
module_name=module,
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -266,6 +295,8 @@ def check_fs(ctx, iocs, output, fast, list_modules, module, hashes, verbose, dum
|
|||||||
module_name=module,
|
module_name=module,
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
)
|
)
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
@@ -300,7 +331,13 @@ def check_fs(ctx, iocs, output, fast, list_modules, module, hashes, verbose, dum
|
|||||||
@click.argument("FOLDER", type=click.Path(exists=True))
|
@click.argument("FOLDER", type=click.Path(exists=True))
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def check_iocs(ctx, iocs, list_modules, module, folder):
|
def check_iocs(ctx, iocs, list_modules, module, folder):
|
||||||
cmd = CmdCheckIOCS(target_path=folder, ioc_files=iocs, module_name=module)
|
cmd = CmdCheckIOCS(
|
||||||
|
target_path=folder,
|
||||||
|
ioc_files=iocs,
|
||||||
|
module_name=module,
|
||||||
|
disable_version_check=_get_disable_flags(ctx)[0],
|
||||||
|
disable_indicator_check=_get_disable_flags(ctx)[1],
|
||||||
|
)
|
||||||
cmd.modules = BACKUP_MODULES + FS_MODULES + MIXED_MODULES
|
cmd.modules = BACKUP_MODULES + FS_MODULES + MIXED_MODULES
|
||||||
|
|
||||||
if list_modules:
|
if list_modules:
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ class CmdIOSCheckBackup(Command):
|
|||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
@@ -34,6 +36,8 @@ class CmdIOSCheckBackup(Command):
|
|||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-backup"
|
self.name = "check-backup"
|
||||||
|
|||||||
@@ -24,16 +24,19 @@ class CmdIOSCheckFS(Command):
|
|||||||
serial: Optional[str] = None,
|
serial: Optional[str] = None,
|
||||||
module_options: Optional[dict] = None,
|
module_options: Optional[dict] = None,
|
||||||
hashes: bool = False,
|
hashes: bool = False,
|
||||||
|
disable_version_check: bool = False,
|
||||||
|
disable_indicator_check: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
target_path=target_path,
|
target_path=target_path,
|
||||||
results_path=results_path,
|
results_path=results_path,
|
||||||
ioc_files=ioc_files,
|
ioc_files=ioc_files,
|
||||||
module_name=module_name,
|
module_name=module_name,
|
||||||
serial=serial,
|
|
||||||
module_options=module_options,
|
module_options=module_options,
|
||||||
hashes=hashes,
|
hashes=hashes,
|
||||||
log=log,
|
log=log,
|
||||||
|
disable_version_check=disable_version_check,
|
||||||
|
disable_indicator_check=disable_indicator_check,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.name = "check-fs"
|
self.name = "check-fs"
|
||||||
|
|||||||
Reference in New Issue
Block a user