Social Eng. extension: added support for SMTP servers that do not require authentication

This commit is contained in:
antisnatchor
2012-08-29 17:50:14 +01:00
parent 92b2382e25
commit 20d2e17232
2 changed files with 19 additions and 6 deletions

View File

@@ -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"

View File

@@ -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