Notifications: Slack: Fix config file WebHook validation (#2820)

This commit is contained in:
bcoles
2023-04-15 18:05:26 +10:00
committed by GitHub
parent eb5959a975
commit 943a6fd226

View File

@@ -18,8 +18,8 @@ module BeEF
channel = @config.get('beef.extension.notifications.slack.channel') channel = @config.get('beef.extension.notifications.slack.channel')
username = @config.get('beef.extension.notifications.slack.username') username = @config.get('beef.extension.notifications.slack.username')
if webhook_url.include?('your_webhook_url') || !webhook_url.start_with?('https://hook\.slack.com/services/') if webhook_url.include?('your_webhook_url') || !webhook_url.start_with?('https://hooks.slack.com/services/')
print_error '[Notifications] Invalid Slack WebHook URL' print_error('[Notifications] Invalid Slack WebHook URL')
return return
end end
@@ -31,6 +31,8 @@ module BeEF
) )
notifier.ping message notifier.ping message
print_debug("[Notifications] Established Slack notification channel: #{webhook_url}")
rescue StandardError => e rescue StandardError => e
print_error "[Notifications] Slack notification initialization failed: #{e.message}" print_error "[Notifications] Slack notification initialization failed: #{e.message}"
end end