CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/osx/admin/say.rb
Views: 1904
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
)
24
)
25
26
register_options(
27
[
28
OptString.new('TEXT', [true, 'The text to say', "meta-sploit\!"]),
29
OptString.new('VOICE', [true, 'The voice to use', 'alex'])
30
]
31
)
32
end
33
34
def exec(cmd)
35
tries = 0
36
begin
37
out = cmd_exec(cmd).chomp
38
rescue ::Timeout::Error => e
39
tries += 1
40
if tries < 3
41
vprint_error("#{@peer} - #{e.message} - retrying...")
42
retry
43
end
44
rescue EOFError => e
45
tries += 1
46
if tries < 3
47
vprint_error("#{@peer} - #{e.message} - retrying...")
48
retry
49
end
50
end
51
end
52
53
def run
54
txt = datastore['TEXT']
55
voice = datastore['VOICE']
56
57
# Say the text
58
out = cmd_exec("say -v \"#{voice}\" \"#{txt}\"")
59
if out =~ /command not found/
60
print_error("The remote machine does not have the \'say\' command")
61
elsif !out.empty?
62
print_status(out)
63
end
64
end
65
end
66
67