Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/extensions/notifications/channels/email.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
#
8
require 'net/smtp'
9
10
module BeEF
11
module Extension
12
module Notifications
13
module Channels
14
class Email
15
#
16
# Constructor
17
#
18
def initialize(to_address, message)
19
@config = BeEF::Core::Configuration.instance
20
@from_address = @config.get('beef.extension.notifications.email.from_address')
21
@smtp_host = @config.get('beef.extension.notifications.email.smtp_host')
22
@smtp_port = @config.get('beef.extension.notifications.email.smtp_port')
23
@smtp_tls_enable = @config.get('beef.extension.notifications.email.smtp_tls_enable')
24
@password = @config.get('beef.extension.notifications.email.smtp_tls_password')
25
26
# configure the email client
27
msg = "Subject: BeEF Notification\n\n#{message}"
28
smtp = Net::SMTP.new @smtp_host, @smtp_port
29
# if @smtp_tls_enable?
30
# smtp.enable_starttls
31
# smtp.start('beefproject.com', @from_address, @password, :login) do
32
# smtp.send_message(msg, @from_address, @to_address)
33
# end
34
# else
35
smtp.start do
36
smtp.send_message(msg, @from_address, to_address)
37
end
38
# end
39
end
40
end
41
end
42
end
43
end
44
end
45
46