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/sms.rb
Views: 11784
# -*- coding: binary -*-12###3#4# The Msf::Auxiliary::Sms mixin allows you to send a text message to5# multiple phones of the same carrier. A valid SMTP server is needed.6#7##89module Msf10module Auxiliary::Sms1112def 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']),19OptPort.new('SMTPPORT', [true, 'The SMTP port to use to send the text messages', 25]),20OptString.new('SMTPUSERNAME', [true, 'The SMTP account to use to send the text messages']),21OptString.new('SMTPPASSWORD', [true, 'The SMTP password to use to send the text messages']),22OptEnum.new('SMSCARRIER', [true, 'The targeted SMS service provider', nil,Rex::Proto::Sms::Model::GATEWAYS.keys.collect { |k| k.to_s }]),23OptString.new('CELLNUMBERS', [true, 'The phone numbers to send to']),24OptString.new('SMSMESSAGE', [true, 'The text message to send']),25OptString.new('SMSSUBJECT', [false, 'The text subject', ''])26], Auxiliary::Sms)2728register_advanced_options(29[30OptEnum.new('SmtpLoginType', [true, 'The SMTP login type', 'login', ['plain', 'login', 'cram_md5']]),31OptString.new('HeloDdomain', [false, 'The domain to use for HELO', ''])32], Auxiliary::Sms)33end343536# Sends a text message to multiple numbers of the same service provider (carrier).37#38# @example This sends a text via Gmail39# smtp = Rex::Proto::Sms::Model::Smtp.new(address: 'smtp.gmail.com', port: 587, username: user, password: pass)40# sms = Rex::Proto::Sms::Client.new(carrier: :verizon, smtp_server: smtp)41# numbers = ['1112223333']42# sms.send_text_to_phones(numbers, 'Hello from Gmail')43#44# @param phone_numbers [<String>Array] An array of numbers of try (of the same carrier)45# @param subject [String] The text subject46# @param message [String] The text to send.47#48# @return [void]49def send_text(phone_numbers, subject, message)50smtp = Rex::Proto::Sms::Model::Smtp.new(51address: datastore['SMTPADDRESS'],52port: datastore['SMTPPORT'],53username: datastore['SMTPUSERNAME'],54password: datastore['SMTPPASSWORD'],55login_type: datastore['SmtpLoginType'].to_sym,56from: datastore['SMTPFROM']57)5859carrier = datastore['SMSCARRIER'].to_sym60sms = Rex::Proto::Sms::Client.new(carrier: carrier, smtp_server: smtp)61sms.send_text_to_phones(phone_numbers, subject, message)62end6364end65end666768