Module: PWN::Plugins::MailAgent

Defined in:
lib/pwn/plugins/mail_agent.rb

Overview

This plugin is used for sending email from multiple mail agents such as corporate mail, yahoo, hotmail/live, and mail relays (spoofing). Supports sending multiple file attachments and works pretty well.

Constant Summary collapse

@@logger =
Supported Method Parameters

parent_mail_agent(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
address: 'smtp server ip or domain',
port: 'smtp port',
tls_auto: true|false,
username: 'optional',
password: 'optional',
debug: true|false

)

PWN::Plugins::PWNLogger.create

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



235
236
237
238
239
# File 'lib/pwn/plugins/mail_agent.rb', line 235

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.gmail(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::MailAgent.gmail(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
username: 'required',
password: 'optional (but will be prompted if not submitted)'
debug: true|false

)



135
136
137
138
139
140
141
142
143
# File 'lib/pwn/plugins/mail_agent.rb', line 135

public_class_method def self.gmail(opts = {})
  opts[:address] = 'smtp.gmail.com'
  opts[:port] = 587
  opts[:tls_auto] = true
  opts[:authentication] = :plain
  parent_mail_agent(opts)
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/pwn/plugins/mail_agent.rb', line 243

public_class_method def self.help
  puts "USAGE:
    #{self}.office365(
      from: 'required',
      to: 'required',
      cc: 'optional',
      bcc: 'optional',
      reply_to: 'optional',
      subject: 'optional',
      html_body: 'optional',
      txt_body: 'optional alternative to :html_body',
      attachments_hash: {
        'attachment_name1.doc': 'attachment file path 1',
        'attachment_name2.xls': 'attachment file path 2'
      },
      username: 'required domain\\username',
      password: 'optional (but will be prompted if not submitted)',
      debug: true|false
    )

    #{self}.gmail(
      from: 'required',
      to: 'required',
      cc: 'optional',
      bcc: 'optional',
      reply_to: 'optional',
      subject: 'optional',
      html_body: 'optional',
      txt_body: 'optional alternative to :html_body',
      attachments_hash: {
        'attachment_name1.doc': 'attachment file path 1',
        'attachment_name2.xls': 'attachment file path 2'
      },
      username: 'required',
      password: 'optional (but will be prompted if not submitted)'
      debug: true|false
    )

    #{self}.hotmail_n_live(
      from: 'required',
      to: 'required',
      cc: 'optional',
      bcc: 'optional',
      reply_to: 'optional',
      subject: 'optional',
      html_body: 'optional',
      txt_body: 'optional alternative to :html_body',
      attachments_hash: {
        'attachment_name1.doc': 'attachment file path 1',
        'attachment_name2.xls': 'attachment file path 2'
      },
      username: 'required',
      password: 'optional (but will be prompted if not submitted)'
      debug: true|false
    )

    #{self}.yahoo(
      from: 'required',
      to: 'required',
      cc: 'optional',
      bcc: 'optional',
      reply_to: 'optional',
      subject: 'optional',
      html_body: 'optional',
      txt_body: 'optional alternative to :html_body',
      attachments_hash: {
        'attachment_name1.doc': 'attachment file path 1',
        'attachment_name2.xls': 'attachment file path 2'
      },
      username: 'required',
      password: 'optional (but will be prompted if not submitted)'
      debug: true|false
    )

    #{self}.manual(
      from: 'required',
      to: 'required',
      cc: 'optional',
      bcc: 'optional',
      reply_to: 'optional',
      subject: 'optional',
      html_body: 'optional',
      txt_body: 'optional alternative to :html_body',
      attachments_hash: {
        'attachment_name1.doc': 'attachment file path 1',
        'attachment_name2.xls': 'attachment file path 2'
      },
      address: 'smtp server ip or domain',
      port: 'smtp port',
      tls_auto: true|false,
      authentication: 'optional defaults to :plain - available :login, :plain, or :cram_md5',
      username: 'optional',
      password: 'optional',
      debug: true|false
    )

    #{self}.authors
  "
end

.hotmail_n_live(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::MailAgent.hotmail_n_live(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
username: 'required',
password: 'optional (but will be prompted if not submitted)'
debug: true|false

)



164
165
166
167
168
169
170
171
172
# File 'lib/pwn/plugins/mail_agent.rb', line 164

public_class_method def self.hotmail_n_live(opts = {})
  opts[:address] = 'smtp.live.com'
  opts[:port] = 587
  opts[:tls_auto] = true
  opts[:authentication] = :plain
  parent_mail_agent(opts)
rescue StandardError => e
  raise e
end

.manual(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::MailAgent.manual(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
address: 'smtp server ip or domain',
port: 'smtp port',
tls_auto: true|false,
username: 'optional',
password: 'optional',
debug: true|false

)



225
226
227
228
229
230
231
# File 'lib/pwn/plugins/mail_agent.rb', line 225

public_class_method def self.manual(opts = {})
  # Spoof mail from known relay
  opts[:authentication] = :plain if opts[:authentication].nil?
  parent_mail_agent(opts)
rescue StandardError => e
  raise e
end

.office365(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::MailAgent.office365(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
username: 'required username',
password: 'optional (but will be prompted if not submitted)',
debug: true|false

)



105
106
107
108
109
110
111
112
113
114
# File 'lib/pwn/plugins/mail_agent.rb', line 105

public_class_method def self.office365(opts = {})
  # Send mail from corporate mail solution
  opts[:address] = 'smtp.office365.com'
  opts[:port] = 587
  opts[:tls_auto] = true
  opts[:authentication] = :login
  parent_mail_agent(opts)
rescue StandardError => e
  raise e
end

.yahoo(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::MailAgent.yahoo(

from: 'required',
to: 'required',
cc: 'optional',
bcc: 'optional',
reply_to: 'optional',
subject: 'optional',
html_body: 'optional',
txt_body: 'optional alternative to :html_body',
attachments_hash: {
  'attachment_name1.doc': 'attachment file path 1',
  'attachment_name2.xls': 'attachment file path 2'
},
username: 'required',
password: 'optional (but will be prompted if not submitted)'
debug: true|false

)



193
194
195
196
197
198
199
200
201
# File 'lib/pwn/plugins/mail_agent.rb', line 193

public_class_method def self.yahoo(opts = {})
  opts[:address] = 'smtp.mail.yahoo.com'
  opts[:port] = 587
  opts[:tls_auto] = true
  opts[:authentication] = :plain
  parent_mail_agent(opts)
rescue StandardError => e
  raise e
end