Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/osx/admin/say.rb
19535 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Post
7
8
def initialize(info = {})
9
super(
10
update_info(
11
info,
12
'Name' => 'OS X Text to Speech Utility',
13
'Description' => %q{
14
This module will speak whatever is in the 'TEXT' option on the victim machine.
15
},
16
'References' => [
17
['URL', 'http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/']
18
],
19
'License' => MSF_LICENSE,
20
'Author' => [ 'sinn3r'],
21
'Platform' => [ 'osx' ],
22
'SessionTypes' => [ 'meterpreter', 'shell' ],
23
'Notes' => {
24
'Stability' => [CRASH_SAFE],
25
'SideEffects' => [AUDIO_EFFECTS],
26
'Reliability' => []
27
}
28
)
29
)
30
31
register_options(
32
[
33
OptString.new('TEXT', [true, 'The text to say', "meta-sploit\!"]),
34
OptString.new('VOICE', [true, 'The voice to use', 'alex'])
35
]
36
)
37
end
38
39
def exec(cmd)
40
tries = 0
41
begin
42
cmd_exec(cmd).chomp
43
rescue ::Timeout::Error => e
44
tries += 1
45
if tries < 3
46
vprint_error("#{@peer} - #{e.message} - retrying...")
47
retry
48
end
49
rescue EOFError => e
50
tries += 1
51
if tries < 3
52
vprint_error("#{@peer} - #{e.message} - retrying...")
53
retry
54
end
55
end
56
end
57
58
def run
59
txt = datastore['TEXT']
60
voice = datastore['VOICE']
61
62
# Say the text
63
out = cmd_exec("say -v \"#{voice}\" \"#{txt}\"")
64
if out =~ /command not found/
65
print_error("The remote machine does not have the \'say\' command")
66
elsif !out.empty?
67
print_status(out)
68
end
69
end
70
end
71
72