From f459d58314d412882285d740aa7c3119e1811022 Mon Sep 17 00:00:00 2001 From: pedrooot Date: Mon, 27 May 2024 08:56:40 +0200 Subject: [PATCH] chore(cli): add list-checks-json --- cli/cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cli/cli.py b/cli/cli.py index 8f7495d133..8cc8cf49a6 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -5,6 +5,7 @@ from prowler.lib.check.check import ( bulk_load_checks_metadata, bulk_load_compliance_frameworks, list_categories, + list_checks_json, list_fixers, list_services, print_categories, @@ -51,6 +52,20 @@ def list_resources(provider: str, resource_type: str): provider, ) print_checks(provider, sorted(checks_to_execute), bulk_checks_metadata) + elif resource_type == "checks-json": + bulk_checks_metadata = bulk_load_checks_metadata(provider) + checks_to_execute = load_checks_to_execute( + bulk_checks_metadata, + bulk_load_compliance_frameworks(provider), + None, + [], + [], + [], + [], + [], + provider, + ) + print(list_checks_json(provider, sorted(checks_to_execute))) def list_compliance_requirements( @@ -108,6 +123,13 @@ def create_list_commands(provider_typer: typer.Typer): def list_checks_command(): list_resources(provider_name, "checks") + @provider_typer.command( + "list-checks-json", + help=f"List the {provider_name} checks that are supported by Prowler in JSON format.", + ) + def list_checks_json_command(): + list_resources(provider_name, "checks-json") + create_list_commands(aws) create_list_commands(azure)