2014-06-10 04:38:26 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2014-06-12 18:20:59 +00:00
|
|
|
require 'msf/core'
|
2014-06-10 04:38:26 +00:00
|
|
|
|
|
|
|
class Metasploit4 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-06-12 18:20:59 +00:00
|
|
|
'Name' => 'Chromecast YouTube Remote Control',
|
|
|
|
'Description' => %q{
|
2014-06-10 04:38:26 +00:00
|
|
|
This module acts as a simple remote control for Chromecast YouTube.
|
|
|
|
},
|
2014-06-12 18:20:59 +00:00
|
|
|
'Author' => ['wvu'],
|
|
|
|
'References' => [
|
|
|
|
['URL', 'https://en.wikipedia.org/wiki/Chromecast']
|
2014-06-10 04:38:26 +00:00
|
|
|
],
|
2014-06-12 18:20:59 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' => [
|
|
|
|
['Play', 'Description' => 'Play video'],
|
|
|
|
['Stop', 'Description' => 'Stop video']
|
2014-06-10 04:38:26 +00:00
|
|
|
],
|
2014-06-12 18:20:59 +00:00
|
|
|
'DefaultAction' => 'Play'
|
2014-06-10 04:38:26 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
Opt::RPORT(8008),
|
2014-06-12 18:20:59 +00:00
|
|
|
OptString.new('VID', [true, 'Video ID', 'kxopViU98Xo'])
|
2014-06-10 04:38:26 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
2014-06-12 18:20:59 +00:00
|
|
|
vid = datastore['VID']
|
2014-06-10 04:38:26 +00:00
|
|
|
|
|
|
|
case action.name
|
2014-06-12 18:20:59 +00:00
|
|
|
when 'Play'
|
2014-06-10 04:38:26 +00:00
|
|
|
res = play(vid)
|
2014-06-12 18:20:59 +00:00
|
|
|
when 'Stop'
|
2014-06-10 04:38:26 +00:00
|
|
|
res = stop
|
|
|
|
end
|
|
|
|
|
|
|
|
return unless res
|
|
|
|
|
|
|
|
case res.code
|
|
|
|
when 201
|
|
|
|
print_good("Playing https://www.youtube.com/watch?v=#{vid}")
|
|
|
|
when 200
|
|
|
|
print_status("Stopping video")
|
|
|
|
when 404
|
|
|
|
print_error("Couldn't #{action.name.downcase} video")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def play(vid)
|
|
|
|
begin
|
|
|
|
send_request_cgi(
|
2014-06-12 18:20:59 +00:00
|
|
|
'method' => 'POST',
|
|
|
|
'uri' => '/apps/YouTube',
|
|
|
|
'agent' => Rex::Text.rand_text_english(rand(42) + 1),
|
|
|
|
'vars_post' => {
|
|
|
|
'v' => vid
|
2014-06-10 04:38:26 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
|
|
|
|
Rex::HostUnreachable => e
|
|
|
|
fail_with(Failure::Unreachable, e)
|
|
|
|
ensure
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def stop
|
|
|
|
begin
|
|
|
|
send_request_raw(
|
2014-06-12 18:20:59 +00:00
|
|
|
'method' => 'DELETE',
|
|
|
|
'uri' => '/apps/YouTube',
|
|
|
|
'agent' => Rex::Text.rand_text_english(rand(42) + 1)
|
2014-06-10 04:38:26 +00:00
|
|
|
)
|
|
|
|
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
|
|
|
|
Rex::HostUnreachable => e
|
|
|
|
fail_with(Failure::Unreachable, e)
|
|
|
|
ensure
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|