diff --git a/prowler/lib/banner.py b/prowler/lib/banner.py index 6a2f47a5d5..0b00d729ad 100644 --- a/prowler/lib/banner.py +++ b/prowler/lib/banner.py @@ -9,7 +9,7 @@ def print_banner(args): | '_ \| '__/ _ \ \ /\ / / |/ _ \ '__| | |_) | | | (_) \ V V /| | __/ | | .__/|_| \___/ \_/\_/ |_|\___|_|v{prowler_version} -|_|{Fore.BLUE} the handy cloud security tool +|_|{Fore.BLUE} the handy multi-cloud security tool {Fore.YELLOW}Date: {timestamp.strftime("%Y-%m-%d %H:%M:%S")}{Style.RESET_ALL} """ diff --git a/prowler/lib/outputs/slack.py b/prowler/lib/outputs/slack.py index 998ffd12a4..9902161e82 100644 --- a/prowler/lib/outputs/slack.py +++ b/prowler/lib/outputs/slack.py @@ -57,6 +57,16 @@ def create_message_identity(provider): ) +def create_title(identity, stats): + try: + title = f"Hey there 👋 \n I'm *Prowler*, _the handy multi-cloud security tool_ :cloud::key:\n\n I have just finished the security assessment on your {identity} with a total of *{stats['findings_count']}* findings." + return title + except Exception as error: + logger.error( + f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}" + ) + + def create_message_blocks(identity, logo, stats): try: blocks = [ @@ -64,7 +74,7 @@ def create_message_blocks(identity, logo, stats): "type": "section", "text": { "type": "mrkdwn", - "text": f"Hey there 👋 \n I'm *Prowler*, _the handy cloud security tool_ :cloud::key:\n\n I have just finished the security assessment on your {identity} with a total of *{stats['findings_count']}* findings.", + "text": create_title(identity, stats), }, "accessory": { "type": "image", diff --git a/tests/lib/outputs/slack_test.py b/tests/lib/outputs/slack_test.py index 53bfc28d1c..8e38d3eb07 100644 --- a/tests/lib/outputs/slack_test.py +++ b/tests/lib/outputs/slack_test.py @@ -5,6 +5,7 @@ from prowler.config.config import aws_logo, azure_logo, gcp_logo from prowler.lib.outputs.slack import ( create_message_blocks, create_message_identity, + create_title, send_slack_message, ) from tests.providers.aws.utils import AWS_ACCOUNT_NUMBER, set_mocked_aws_provider @@ -65,7 +66,7 @@ class TestSlackIntegration: "type": "section", "text": { "type": "mrkdwn", - "text": f"Hey there 👋 \n I'm *Prowler*, _the handy cloud security tool_ :cloud::key:\n\n I have just finished the security assessment on your {aws_identity} with a total of *{stats['findings_count']}* findings.", + "text": create_title(aws_identity, stats), }, "accessory": { "type": "image", @@ -145,7 +146,7 @@ class TestSlackIntegration: "type": "section", "text": { "type": "mrkdwn", - "text": f"Hey there 👋 \n I'm *Prowler*, _the handy cloud security tool_ :cloud::key:\n\n I have just finished the security assessment on your {azure_identity} with a total of *{stats['findings_count']}* findings.", + "text": create_title(azure_identity, stats), }, "accessory": { "type": "image", @@ -225,7 +226,7 @@ class TestSlackIntegration: "type": "section", "text": { "type": "mrkdwn", - "text": f"Hey there 👋 \n I'm *Prowler*, _the handy cloud security tool_ :cloud::key:\n\n I have just finished the security assessment on your {gcp_identity} with a total of *{stats['findings_count']}* findings.", + "text": create_title(gcp_identity, stats), }, "accessory": { "type": "image",