Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/core/auxiliary/mms.rb
Views: 11784
# -*- coding: binary -*-12###3#4# The Msf::Auxiliary::Mms mixin allows you to send a text message5# including a media file.6#7##89module Msf10module Auxiliary::Mms1112def initialize(info={})13super1415register_options(16[17OptString.new('SMTPFROM', [false, 'The FROM field for SMTP', '']),18OptString.new('SMTPADDRESS', [ true, 'The SMTP server to use to send the text messages']),19OptString.new('MMSSUBJECT', [false, 'The Email subject', '']),20OptPort.new('SMTPPORT', [true, 'The SMTP port to use to send the text messages', 25]),21OptString.new('SMTPUSERNAME', [true, 'The SMTP account to use to send the text messages']),22OptString.new('SMTPPASSWORD', [true, 'The SMTP password to use to send the text messages']),23OptEnum.new('MMSCARRIER', [true, 'The targeted MMS service provider', nil,Rex::Proto::Mms::Model::GATEWAYS.keys.collect { |k| k.to_s }]),24OptString.new('CELLNUMBERS', [true, 'The phone numbers to send to']),25OptString.new('TEXTMESSAGE', [true, 'The text message to send']),26OptPath.new('MMSFILE', [false, 'The attachment to include in the text file']),27OptString.new('MMSFILECTYPE', [false, 'The attachment content type'])28], Auxiliary::Mms)2930register_advanced_options(31[32OptEnum.new('SmtpLoginType', [true, 'The SMTP login type', 'login', ['plain', 'login', 'cram_md5']]),33OptString.new('HeloDdomain', [false, 'The domain to use for HELO', ''])34], Auxiliary::Mms)35end363738# Sends an MMS message to multiple numbers of the same service provider (carrier).39#40# @example This sends a text (including an attachment) via Gmail41# smtp = Rex::Proto::Mms::Model::Smtp.new(address: 'smtp.gmail.com', port: 587, username: user, password: pass)42# mms = Rex::Proto::Mms::Client.new(carrier: :verizon, smtp_server: smtp)43# mms.send_mms_to_phones(numbers, 'hello world?', '/tmp/test.jpg', 'image/jpeg')44#45# @param phone_numbers [<String>Array] An array of numbers of try (of the same carrier)46# @param subject [String] MMS subject47# @param message [String] The text to send.48# @param attachment_path [String] Optional49# @param ctype [String] Optional50#51# @return [void]52def send_mms(phone_numbers, subject, message, attachment_path=nil, ctype=nil)53smtp = Rex::Proto::Mms::Model::Smtp.new(54address: datastore['SMTPADDRESS'],55port: datastore['SMTPPORT'],56username: datastore['SMTPUSERNAME'],57password: datastore['SMTPPASSWORD'],58login_type: datastore['SmtpLoginType'].to_sym,59from: datastore['SMTPFROM'],60)6162carrier = datastore['MMSCARRIER'].to_sym63mms = Rex::Proto::Mms::Client.new(carrier: carrier, smtp_server: smtp)64mms.send_mms_to_phones(phone_numbers, subject, message, attachment_path, ctype)65end6667end68end697071