Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/extensions/notifications/notifications.rb
1154 views
1
#
2
# Copyright (c) 2006-2025 Wade Alcorn - [email protected]
3
# Browser Exploitation Framework (BeEF) - https://beefproject.com
4
# See the file 'doc/COPYING' for copying permission
5
#
6
7
require 'extensions/notifications/channels/email'
8
require 'extensions/notifications/channels/pushover'
9
require 'extensions/notifications/channels/slack_workspace'
10
require 'extensions/notifications/channels/ntfy'
11
12
13
module BeEF
14
module Extension
15
module Notifications
16
#
17
# Notifications class
18
#
19
class Notifications
20
def initialize(from, event, time_now, hb)
21
@config = BeEF::Core::Configuration.instance
22
return unless @config.get('beef.extension.notifications.enable')
23
24
@from = from
25
@event = event
26
@time_now = time_now
27
@hb = hb
28
29
message = "#{from} #{event} #{time_now} #{hb}"
30
31
if @config.get('beef.extension.notifications.email.enable') == true
32
to_address = @config.get('beef.extension.notifications.email.to_address')
33
BeEF::Extension::Notifications::Channels::Email.new(to_address, message)
34
end
35
36
BeEF::Extension::Notifications::Channels::Pushover.new(message) if @config.get('beef.extension.notifications.pushover.enable') == true
37
38
BeEF::Extension::Notifications::Channels::SlackWorkspace.new(message) if @config.get('beef.extension.notifications.slack.enable') == true
39
40
BeEF::Extension::Notifications::Channels::Ntfy.new(message) if @config.get('beef.extension.notifications.ntfy.enable') == true
41
42
end
43
end
44
end
45
end
46
end
47
48