Path: blob/master/extensions/notifications/channels/slack_workspace.rb
1154 views
#1# Copyright (c) 2006-2025 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#5require 'slack-notifier'67module BeEF8module Extension9module Notifications10module Channels11class SlackWorkspace12def initialize(message)13@config = BeEF::Core::Configuration.instance1415# Configure the Slack Client16webhook_url = @config.get('beef.extension.notifications.slack.webhook_url')17channel = @config.get('beef.extension.notifications.slack.channel')18username = @config.get('beef.extension.notifications.slack.username')1920if webhook_url.include?('your_webhook_url') || !webhook_url.start_with?('https://hooks.slack.com/services/')21print_error('[Notifications] Invalid Slack WebHook URL')22return23end2425notifier = Slack::Notifier.new(26webhook_url,27channel: channel,28username: username,29http_options: { open_timeout: 10 }30)3132notifier.ping message3334print_debug("[Notifications] Established Slack notification channel: #{webhook_url}")35rescue StandardError => e36print_error "[Notifications] Slack notification initialization failed: #{e.message}"37end38end39end40end41end42end434445