metasploit-framework/modules/post/osx/admin/say.rb

70 lines
1.7 KiB
Ruby
Raw Normal View History

2012-05-22 08:03:30 +00:00
##
# 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'
class Metasploit3 < Msf::Post
def initialize(info={})
super( update_info( info,
2012-08-14 20:29:21 +00:00
'Name' => "OS X Text to Speech Utility",
2012-05-22 08:03:30 +00:00
'Description' => %q{
This module will speak whatever is in the 'TEXT' option on the victim machine.
},
2012-05-22 15:52:54 +00:00
'References' =>
[
['URL', 'http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/']
],
2012-05-22 08:03:30 +00:00
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r'],
'Platform' => [ 'osx' ],
'SessionTypes' => [ "shell" ]
))
2013-08-30 21:28:54 +00:00
register_options(
[
OptString.new('TEXT', [true, 'The text to say', "meta-sploit\!"]),
OptString.new('VOICE', [true, 'The voice to use', 'alex'])
], self.class)
end
2012-05-22 08:03:30 +00:00
2013-08-30 21:28:54 +00:00
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
2012-05-22 08:03:30 +00:00
2013-08-30 21:28:54 +00:00
def run
txt = datastore['TEXT']
voice = datastore['VOICE']
2012-05-22 08:03:30 +00:00
2013-08-30 21:28:54 +00:00
# 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
2012-05-22 08:03:30 +00:00
end