Module: Msf::Auxiliary::Mms

Defined in:
lib/msf/core/auxiliary/mms.rb

Instance Method Summary collapse

Instance Method Details

#initialize(info = {}) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/msf/core/auxiliary/mms.rb', line 13

def initialize(info={})
  super

  register_options(
    [
      OptString.new('SMTPFROM', [false, 'The FROM field for SMTP', '']),
      OptString.new('SMTPADDRESS', [ true, 'The SMTP server to use to send the text messages']),
      OptString.new('MMSSUBJECT', [false, 'The Email subject', '']),
      OptPort.new('SMTPPORT', [true, 'The SMTP port to use to send the text messages', 25]),
      OptString.new('SMTPUSERNAME', [true, 'The SMTP account to use to send the text messages']),
      OptString.new('SMTPPASSWORD', [true, 'The SMTP password to use to send the text messages']),
      OptEnum.new('MMSCARRIER', [true, 'The targeted MMS service provider', nil,Rex::Proto::Mms::Model::GATEWAYS.keys.collect { |k| k.to_s }]),
      OptString.new('CELLNUMBERS', [true, 'The phone numbers to send to']),
      OptString.new('TEXTMESSAGE', [true, 'The text message to send']),
      OptPath.new('MMSFILE', [false, 'The attachment to include in the text file']),
      OptString.new('MMSFILECTYPE', [false, 'The attachment content type'])
    ], Auxiliary::Mms)

  register_advanced_options(
    [
      OptEnum.new('SmtpLoginType', [true, 'The SMTP login type', 'login', ['plain', 'login', 'cram_md5']]),
      OptString.new('HeloDdomain', [false, 'The domain to use for HELO', ''])
    ], Auxiliary::Mms)
end

#send_mms(phone_numbers, subject, message, attachment_path = nil, ctype = nil) ⇒ void

This method returns an undefined value.

Sends an MMS message to multiple numbers of the same service provider (carrier).

Examples:

This sends a text (including an attachment) via Gmail

smtp = Rex::Proto::Mms::Model::Smtp.new(address: 'smtp.gmail.com', port: 587, username: user, password: pass)
mms = Rex::Proto::Mms::Client.new(carrier: :verizon, smtp_server: smtp)
mms.send_mms_to_phones(numbers, 'hello world?', '/tmp/test.jpg', 'image/jpeg')

Parameters:

  • phone_numbers (<String>Array)

    An array of numbers of try (of the same carrier)

  • subject (String)

    MMS subject

  • message (String)

    The text to send.

  • attachment_path (String) (defaults to: nil)

    Optional

  • ctype (String) (defaults to: nil)

    Optional


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/msf/core/auxiliary/mms.rb', line 53

def send_mms(phone_numbers, subject, message, attachment_path=nil, ctype=nil)
  smtp = Rex::Proto::Mms::Model::Smtp.new(
    address: datastore['SMTPADDRESS'],
    port: datastore['SMTPPORT'],
    username: datastore['SMTPUSERNAME'],
    password: datastore['SMTPPASSWORD'],
    login_type: datastore['SmtpLoginType'].to_sym,
    from: datastore['SMTPFROM'],
  )

  carrier = datastore['MMSCARRIER'].to_sym
  mms = Rex::Proto::Mms::Client.new(carrier: carrier, smtp_server: smtp)
  mms.send_mms_to_phones(phone_numbers, subject, message, attachment_path, ctype)
end