mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
Apply jabra's patch for smtp output
git-svn-id: file:///home/svn/framework3/trunk@6766 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
f76d73a823
commit
bb4b4dbcb0
@ -26,38 +26,59 @@ module Exploit::Remote::SMTPDeliver
|
||||
Opt::RPORT(25),
|
||||
OptString.new('MAILFROM', [ true, 'The FROM address of the e-mail', 'random@example.com']),
|
||||
OptString.new('MAILTO', [ true, 'The TO address of the e-mail']),
|
||||
OptString.new('VERBOSE', [ false, 'Display verbose information']),
|
||||
], Msf::Exploit::Remote::SMTPDeliver)
|
||||
end
|
||||
|
||||
|
||||
# This method connects to the server and sends a message
|
||||
def send_message(data)
|
||||
|
||||
print_status("Connecting to SMTP server #{rhost}:#{rport}...")
|
||||
|
||||
if datastore['VERBOSE']
|
||||
print_status("Connecting to SMTP server #{rhost}:#{rport}...")
|
||||
end
|
||||
msock = connect(false)
|
||||
res = msock.get_once
|
||||
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
res = raw_send_recv("EHLO #{Rex::Text.rand_text_alpha(rand(32)+1)}\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
res = raw_send_recv("MAIL FROM: #{datastore['MAILFROM']}\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
res = raw_send_recv("RCPT TO: #{datastore['MAILTO']}\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
print_status("Sending the message (#{data.length} bytes)...")
|
||||
if datastore['VERBOSE']
|
||||
print_status("Sending the message (#{data.length} bytes)...")
|
||||
end
|
||||
res = raw_send_recv("DATA\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
res = raw_send_recv("#{data}\r\n.\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
print_status("Closing the connection...")
|
||||
if datastore['VERBOSE']
|
||||
print_status("Closing the connection...")
|
||||
end
|
||||
res = raw_send_recv("QUIT\r\n", msock)
|
||||
print_status("SMTP: #{res.strip}")
|
||||
if datastore['VERBOSE']
|
||||
print_status("SMTP: #{res.strip}")
|
||||
end
|
||||
|
||||
msock.close
|
||||
end
|
||||
@ -70,4 +91,4 @@ module Exploit::Remote::SMTPDeliver
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user