Skip to content
Permalink
Browse files

Land #11933, add default VID and cmd/unix support to post/multi/manag…

…e/play_youtube
  • Loading branch information...
timwr committed Jun 2, 2019
2 parents d335415 + 42082f0 commit b5bdc06c4c257fcba746bcc6900e749cdcd8ecb0
Showing with 15 additions and 5 deletions.
  1. +15 −5 modules/post/multi/manage/play_youtube.rb
@@ -21,7 +21,7 @@ def initialize(info={})
},
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r' ],
'Platform' => [ 'win', 'osx', 'linux', 'android' ],
'Platform' => [ 'win', 'osx', 'linux', 'android', 'unix' ],
'SessionTypes' => [ 'shell', 'meterpreter' ],
'Notes' =>
{
@@ -33,7 +33,7 @@ def initialize(info={})
register_options(
[
OptBool.new('EMBED', [true, 'Use the embed version of the YouTube URL', true]),
OptString.new('VID', [true, 'The video ID to the YouTube video'])
OptString.new('VID', [true, 'The video ID to the YouTube video', 'kxopViU98Xo'])
])
end

@@ -48,7 +48,7 @@ def youtube_url
#
# The OSX version uses an apple script to do this
#
def osx_start_video(id)
def osx_start_video(_id)
script = ''
script << %Q|osascript -e 'tell application "Safari" to open location "#{youtube_url}"' |
script << %Q|-e 'activate application "Safari"' |
@@ -66,7 +66,7 @@ def osx_start_video(id)
#
# The Windows version uses the "embed" player to make sure IE won't download the SWF as an object
#
def win_start_video(id)
def win_start_video(_id)
iexplore_path = "C:\\Program Files\\Internet Explorer\\iexplore.exe"
begin
session.sys.process.execute(iexplore_path, "-k #{youtube_url}")
@@ -82,7 +82,7 @@ def win_start_video(id)
# The Linux version uses Firefox
# TODO: Try xdg-open?
#
def linux_start_video(id)
def linux_start_video(_id)
begin
# Create a profile
profile_name = Rex::Text.rand_text_alpha(8)
@@ -121,6 +121,14 @@ def android_start_video(id)
true
end

# The generic Unix version calls xdg-open(1) or open(1)
def unix_start_video(_id)
cmd_exec("xdg-open '#{youtube_url}' || open '#{youtube_url}'")
true
rescue EOFError
false
end

def start_video(id)
case session.platform
when 'osx'
@@ -131,6 +139,8 @@ def start_video(id)
linux_start_video(id)
when 'android'
android_start_video(id)
when 'unix'
unix_start_video(id)
end
end

0 comments on commit b5bdc06

Please sign in to comment.
You can’t perform that action at this time.