Path: blob/master/extensions/notifications/channels/email.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#5#6#7require 'net/smtp'89module BeEF10module Extension11module Notifications12module Channels13class Email14#15# Constructor16#17def initialize(to_address, message)18@config = BeEF::Core::Configuration.instance19@from_address = @config.get('beef.extension.notifications.email.from_address')20@smtp_host = @config.get('beef.extension.notifications.email.smtp_host')21@smtp_port = @config.get('beef.extension.notifications.email.smtp_port')22@smtp_tls_enable = @config.get('beef.extension.notifications.email.smtp_tls_enable')23@password = @config.get('beef.extension.notifications.email.smtp_tls_password')2425# configure the email client26msg = "Subject: BeEF Notification\n\n#{message}"27smtp = Net::SMTP.new @smtp_host, @smtp_port28# if @smtp_tls_enable?29# smtp.enable_starttls30# smtp.start('beefproject.com', @from_address, @password, :login) do31# smtp.send_message(msg, @from_address, @to_address)32# end33# else34smtp.start do35smtp.send_message(msg, @from_address, to_address)36end37# end38end39end40end41end42end43end444546