Skip to content

Commit 17b5d3c

Browse files
committed
Add support for OSX
1 parent 509ebdd commit 17b5d3c

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

modules/post/windows/manage/youtube_broadcast.rb

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def initialize(info={})
1919
},
2020
'License' => MSF_LICENSE,
2121
'Author' => [ 'sinn3r'],
22-
'Platform' => [ 'win'],
23-
'SessionTypes' => [ 'meterpreter' ]
22+
'Platform' => [ 'win', 'osx' ],
23+
'SessionTypes' => [ 'shell', 'meterpreter' ]
2424
))
2525

2626
register_options(
@@ -33,7 +33,24 @@ def peer
3333
"#{session.session_host}:#{session.session_port}"
3434
end
3535

36-
def start_video(id)
36+
37+
#
38+
# The OSX version uses an action script to do this
39+
#
40+
def osx_start_video(id)
41+
url = "https://youtube.googleapis.com/v/#{id}?fs=1&autoplay=1"
42+
script = ''
43+
script << %Q|osascript -e 'tell application "Safari" to open location "#{url}"' |
44+
script << %Q|-e 'activate application "Safari"' |
45+
script << %Q|-e 'tell application "System Events" to key code {59, 55, 3}'|
46+
47+
cmd_exec(script)
48+
end
49+
50+
#
51+
# The Windows version uses the "embed" player to make sure IE won't download the SWF as an object
52+
#
53+
def win_start_video(id)
3754
iexplore_path = "C:\\Program Files\\Internet Explorer\\iexplore.exe"
3855
begin
3956
session.sys.process.execute(iexplore_path, "-k http://youtube.com/embed/#{id}?autoplay=1")
@@ -44,6 +61,15 @@ def start_video(id)
4461
true
4562
end
4663

64+
def start_video(id)
65+
case session.platform
66+
when /osx/
67+
osx_start_video(id)
68+
when /win/
69+
win_start_video(id)
70+
end
71+
end
72+
4773
def run
4874
id = datastore['VID']
4975

0 commit comments

Comments
 (0)