feat(inventory): change name and behaviour

This commit is contained in:
pedrooot
2024-10-03 11:57:17 +02:00
parent 2cf1f22235
commit d437d1c4b8
2 changed files with 3 additions and 11 deletions
+2 -2
View File
@@ -71,9 +71,9 @@ from prowler.providers.aws.lib.s3.s3 import S3
from prowler.providers.aws.lib.security_hub.security_hub import SecurityHub
from prowler.providers.aws.models import AWSOutputOptions
from prowler.providers.azure.models import AzureOutputOptions
from prowler.providers.common.inventory import run_prowler_inventory
from prowler.providers.common.provider import Provider
from prowler.providers.common.quick_inventory import run_provider_quick_inventory
from prowler.providers.common.scan_inventory import run_prowler_scan_inventory
from prowler.providers.gcp.models import GCPOutputOptions
from prowler.providers.kubernetes.models import KubernetesOutputOptions
@@ -691,7 +691,7 @@ def prowler():
# Run the quick inventory for the provider if available
if hasattr(args, "scan_inventory") and args.scan_inventory:
run_prowler_inventory(checks_to_execute, args.provider)
run_prowler_scan_inventory(checks_to_execute, args.provider)
sys.exit()
# If there are failed findings exit code 3, except if -z is input
@@ -10,9 +10,8 @@ from pydantic import BaseModel
from prowler.config.config import orange_color
def run_prowler_inventory(checks_to_execute, provider):
def run_prowler_scan_inventory(checks_to_execute, provider):
output_folder_path = f"./output/inventory/{provider}"
meta_json_file = {}
os.makedirs(output_folder_path, exist_ok=True)
@@ -89,16 +88,9 @@ def run_prowler_inventory(checks_to_execute, provider):
client_path = getattr(lib, f"{service_client}")
if not meta_json_file.get(f"{service}"):
meta_json_file[f"{service}"] = []
# Convert to JSON
output_file = service_client.split("_client")[0]
meta_json_file[f"{service}"].append(
f"./{service}/{output_file}_output.json"
)
with open(
f"{service_output_folder}/{output_file}_output.json", "w+"
) as fp: