From 20d2e172329064ccd9d45f988a4a8395fbc747a7 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Wed, 29 Aug 2012 17:50:14 +0100 Subject: [PATCH] Social Eng. extension: added support for SMTP servers that do not require authentication --- extensions/social_engineering/config.yaml | 1 + .../mass_mailer/mass_mailer.rb | 24 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/extensions/social_engineering/config.yaml b/extensions/social_engineering/config.yaml index ad4c5d529..54cb64e62 100644 --- a/extensions/social_engineering/config.yaml +++ b/extensions/social_engineering/config.yaml @@ -26,6 +26,7 @@ beef: user_agent: "Microsoft-MacOutlook/12.12.0.111556" host: "smtp.gmail.com" port: 587 + use_auth: true use_tls: true helo: "gmail.com" # this is usually the domain name from: "yourmail@gmail.com" diff --git a/extensions/social_engineering/mass_mailer/mass_mailer.rb b/extensions/social_engineering/mass_mailer/mass_mailer.rb index ae0feb901..2e61b4dd8 100644 --- a/extensions/social_engineering/mass_mailer/mass_mailer.rb +++ b/extensions/social_engineering/mass_mailer/mass_mailer.rb @@ -55,12 +55,24 @@ module BeEF # create a new SMTP object, enable TLS with the previous instantiated context, and connects to the server smtp = Net::SMTP.new(@host, @port) smtp.enable_starttls(@ctx) unless @config.get("#{@config_prefix}.use_tls") == false - smtp.start(@helo, @from, @password, :login) do |smtp| - tos_hash.each do |mail, name| - message = compose_email(fromname, mail, name, subject, link, linktext, template) - smtp.send_message(message, @from, mail) - print_info "Mail #{x}/#{n} to [#{mail}] sent." - x += 1 + + if @config.get("#{@config_prefix}.use_auth") + smtp.start(@helo, @from, @password, :login) do |smtp| + tos_hash.each do |to, name| + message = compose_email(fromname, to, name, subject, link, linktext, template) + smtp.send_message(message, @from, to) + print_info "Mail #{x}/#{n} to [#{to}] sent." + x += 1 + end + end + else + smtp.start(@helo, @from) do |smtp| + tos_hash.each do |to, name| + message = compose_email(fromname, to, name, subject, link, linktext, template) + smtp.send_message(message, @from, to) + print_info "Mail #{x}/#{n} to [#{to}] sent." + x += 1 + end end end end