Class: Rex::Proto::Mms::Model::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/mms/model/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Rex::Proto::Mms::Model::Message

Initializes the SMTP object.

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :from (String)
  • :to (String)
  • :message (String)
  • :content_type (String)
  • :attachment_path (String)


49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rex/proto/mms/model/message.rb', line 49

def initialize(opts={})
  self.from = opts[:from]
  self.to = opts[:to]
  self.message = opts[:message]
  self.subject = opts[:subject]
  self.content_type = opts[:content_type]
  if opts[:attachment_path]
    self.attachment = load_file_to_base64(opts[:attachment_path])
    self.attachment_name = File.basename(opts[:attachment_path])
  end
end

Instance Attribute Details

#attachmentString

Returns The loaded attachment converted to Base64.

Returns:

  • (String)

    The loaded attachment converted to Base64



20
21
22
# File 'lib/rex/proto/mms/model/message.rb', line 20

def attachment
  @attachment
end

#attachment_nameString

Returns The attachment base name extracted from :attachment.

Returns:

  • (String)

    The attachment base name extracted from :attachment



36
37
38
# File 'lib/rex/proto/mms/model/message.rb', line 36

def attachment_name
  @attachment_name
end

#content_typeFixnum

Returns The content type of the attachment.

Returns:

  • (Fixnum)

    The content type of the attachment



16
17
18
# File 'lib/rex/proto/mms/model/message.rb', line 16

def content_type
  @content_type
end

#fromString

Returns The from field in the email.

Returns:

  • (String)

    The from field in the email



24
25
26
# File 'lib/rex/proto/mms/model/message.rb', line 24

def from
  @from
end

#messageString

Returns The text message.

Returns:

  • (String)

    The text message



12
13
14
# File 'lib/rex/proto/mms/model/message.rb', line 12

def message
  @message
end

#subjectString

Returns The subject of the email.

Returns:

  • (String)

    The subject of the email



32
33
34
# File 'lib/rex/proto/mms/model/message.rb', line 32

def subject
  @subject
end

#toString

Returns The to field in the email.

Returns:

  • (String)

    The to field in the email



28
29
30
# File 'lib/rex/proto/mms/model/message.rb', line 28

def to
  @to
end

Instance Method Details

#to_sString

Returns the raw MMS message

Returns:

  • (String)


65
66
67
# File 'lib/rex/proto/mms/model/message.rb', line 65

def to_s
  generate_mms_message
end