Path: blob/master/modules/post/osx/admin/say.rb
19535 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67def initialize(info = {})8super(9update_info(10info,11'Name' => 'OS X Text to Speech Utility',12'Description' => %q{13This module will speak whatever is in the 'TEXT' option on the victim machine.14},15'References' => [16['URL', 'http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/']17],18'License' => MSF_LICENSE,19'Author' => [ 'sinn3r'],20'Platform' => [ 'osx' ],21'SessionTypes' => [ 'meterpreter', 'shell' ],22'Notes' => {23'Stability' => [CRASH_SAFE],24'SideEffects' => [AUDIO_EFFECTS],25'Reliability' => []26}27)28)2930register_options(31[32OptString.new('TEXT', [true, 'The text to say', "meta-sploit\!"]),33OptString.new('VOICE', [true, 'The voice to use', 'alex'])34]35)36end3738def exec(cmd)39tries = 040begin41cmd_exec(cmd).chomp42rescue ::Timeout::Error => e43tries += 144if tries < 345vprint_error("#{@peer} - #{e.message} - retrying...")46retry47end48rescue EOFError => e49tries += 150if tries < 351vprint_error("#{@peer} - #{e.message} - retrying...")52retry53end54end55end5657def run58txt = datastore['TEXT']59voice = datastore['VOICE']6061# Say the text62out = cmd_exec("say -v \"#{voice}\" \"#{txt}\"")63if out =~ /command not found/64print_error("The remote machine does not have the \'say\' command")65elsif !out.empty?66print_status(out)67end68end69end707172