fix(output_filename): Use custom output filename when set (#1632)

This commit is contained in:
Pepe Fagoaga
2023-01-02 10:37:01 +01:00
committed by GitHub
parent 98bc3f18fe
commit 99d1cea537
3 changed files with 9 additions and 4 deletions

View File

@@ -115,7 +115,6 @@ Detailed documentation at https://docs.prowler.cloud
"-F",
"--output-filename",
nargs="?",
default=None,
help="Custom output report name without the file extension, if not specified will use default output/prowler-output-ACCOUNT_NUM-OUTPUT_DATE.format",
)
common_outputs_parser.add_argument(

View File

@@ -183,7 +183,7 @@ class Aws_Check_Output_CSV(Check_Output_CSV):
Aws_Check_Output_CSV generates a finding's output in CSV format for the AWS provider.
"""
profile: str
profile: Optional[str]
account_id: int
account_name: Optional[str]
account_email: Optional[str]

View File

@@ -60,7 +60,10 @@ class Azure_Output_Options(Provider_Output_Options):
super().__init__(arguments, allowlist_file, bulk_checks_metadata)
# Check if custom output filename was input, if not, set the default
if not hasattr(arguments, "output_filename"):
if (
not hasattr(arguments, "output_filename")
or arguments.output_filename is None
):
if audit_info.identity.domain:
self.output_filename = f"prowler-output-{audit_info.identity.domain}-{output_file_timestamp}"
else:
@@ -85,7 +88,10 @@ class Aws_Output_Options(Provider_Output_Options):
change_config_var("shodan_api_key", arguments.shodan)
# Check if custom output filename was input, if not, set the default
if not hasattr(arguments, "output_filename"):
if (
not hasattr(arguments, "output_filename")
or arguments.output_filename is None
):
self.output_filename = (
f"prowler-output-{audit_info.audited_account}-{output_file_timestamp}"
)