From ca08e225fb3f9465345c5545bc9536fa237ea040 Mon Sep 17 00:00:00 2001 From: sinn3r Date: Tue, 22 May 2012 03:03:30 -0500 Subject: [PATCH] Add OSX Text-to-Speech tool --- modules/post/osx/admin/say.rb | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 modules/post/osx/admin/say.rb diff --git a/modules/post/osx/admin/say.rb b/modules/post/osx/admin/say.rb new file mode 100644 index 0000000000..25438a71e6 --- /dev/null +++ b/modules/post/osx/admin/say.rb @@ -0,0 +1,68 @@ +## +# This file is part of the Metasploit Framework and may be subject to +# redistribution and commercial restrictions. Please see the Metasploit +# web site for more information on licensing and terms of use. +# http://metasploit.com/ +## + +require 'msf/core' +require 'msf/core/post/common' + +class Metasploit3 < Msf::Post + + include Msf::Post::Common + + def initialize(info={}) + super( update_info( info, + 'Name' => "OSX Text to Speech", + 'Description' => %q{ + This module will speak whatever is in the 'TEXT' option on the victim machine. + }, + 'License' => MSF_LICENSE, + 'Author' => [ 'sinn3r'], + 'Platform' => [ 'osx' ], + 'SessionTypes' => [ "shell" ] + )) + + register_options( + [ + OptString.new('TEXT', [true, 'The text to say', "meta-sploit\!"]), + OptString.new('VOICE', [true, 'The voice to use', 'alex']) + ], self.class) + end + + + def exec(cmd) + tries = 0 + begin + out = cmd_exec(cmd).chomp + rescue ::Timeout::Error => e + tries += 1 + if tries < 3 + vprint_error("#{@peer} - #{e.message} - retrying...") + retry + end + rescue EOFError => e + tries += 1 + if tries < 3 + vprint_error("#{@peer} - #{e.message} - retrying...") + retry + end + end + end + + + def run + txt = datastore['TEXT'] + voice = datastore['VOICE'] + + # Say the text + out = cmd_exec("say -v \"#{voice}\" \"#{txt}\"") + if out =~ /command not found/ + print_error("The remote machine does not have the \'say\' command") + elsif not out.empty? + print_status(out) + end + end + +end \ No newline at end of file