CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/auxiliary/mms.rb
Views: 11784
1
# -*- coding: binary -*-
2
3
###
4
#
5
# The Msf::Auxiliary::Mms mixin allows you to send a text message
6
# including a media file.
7
#
8
##
9
10
module Msf
11
module Auxiliary::Mms
12
13
def initialize(info={})
14
super
15
16
register_options(
17
[
18
OptString.new('SMTPFROM', [false, 'The FROM field for SMTP', '']),
19
OptString.new('SMTPADDRESS', [ true, 'The SMTP server to use to send the text messages']),
20
OptString.new('MMSSUBJECT', [false, 'The Email subject', '']),
21
OptPort.new('SMTPPORT', [true, 'The SMTP port to use to send the text messages', 25]),
22
OptString.new('SMTPUSERNAME', [true, 'The SMTP account to use to send the text messages']),
23
OptString.new('SMTPPASSWORD', [true, 'The SMTP password to use to send the text messages']),
24
OptEnum.new('MMSCARRIER', [true, 'The targeted MMS service provider', nil,Rex::Proto::Mms::Model::GATEWAYS.keys.collect { |k| k.to_s }]),
25
OptString.new('CELLNUMBERS', [true, 'The phone numbers to send to']),
26
OptString.new('TEXTMESSAGE', [true, 'The text message to send']),
27
OptPath.new('MMSFILE', [false, 'The attachment to include in the text file']),
28
OptString.new('MMSFILECTYPE', [false, 'The attachment content type'])
29
], Auxiliary::Mms)
30
31
register_advanced_options(
32
[
33
OptEnum.new('SmtpLoginType', [true, 'The SMTP login type', 'login', ['plain', 'login', 'cram_md5']]),
34
OptString.new('HeloDdomain', [false, 'The domain to use for HELO', ''])
35
], Auxiliary::Mms)
36
end
37
38
39
# Sends an MMS message to multiple numbers of the same service provider (carrier).
40
#
41
# @example This sends a text (including an attachment) via Gmail
42
# smtp = Rex::Proto::Mms::Model::Smtp.new(address: 'smtp.gmail.com', port: 587, username: user, password: pass)
43
# mms = Rex::Proto::Mms::Client.new(carrier: :verizon, smtp_server: smtp)
44
# mms.send_mms_to_phones(numbers, 'hello world?', '/tmp/test.jpg', 'image/jpeg')
45
#
46
# @param phone_numbers [<String>Array] An array of numbers of try (of the same carrier)
47
# @param subject [String] MMS subject
48
# @param message [String] The text to send.
49
# @param attachment_path [String] Optional
50
# @param ctype [String] Optional
51
#
52
# @return [void]
53
def send_mms(phone_numbers, subject, message, attachment_path=nil, ctype=nil)
54
smtp = Rex::Proto::Mms::Model::Smtp.new(
55
address: datastore['SMTPADDRESS'],
56
port: datastore['SMTPPORT'],
57
username: datastore['SMTPUSERNAME'],
58
password: datastore['SMTPPASSWORD'],
59
login_type: datastore['SmtpLoginType'].to_sym,
60
from: datastore['SMTPFROM'],
61
)
62
63
carrier = datastore['MMSCARRIER'].to_sym
64
mms = Rex::Proto::Mms::Client.new(carrier: carrier, smtp_server: smtp)
65
mms.send_mms_to_phones(phone_numbers, subject, message, attachment_path, ctype)
66
end
67
68
end
69
end
70
71