Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/chromecast/chromecast_youtube.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient78def initialize(info = {})9super(update_info(info,10'Name' => 'Chromecast YouTube Remote Control',11'Description' => %q{12This module acts as a simple remote control for Chromecast YouTube.1314Only the deprecated DIAL protocol is supported by this module.15Casting via the newer CASTV2 protocol is unsupported at this time.16},17'Author' => ['wvu'],18'References' => [19['URL', 'http://www.google.com/intl/en/chrome/devices/chromecast/index.html'] # vendor website20],21'License' => MSF_LICENSE,22'Actions' => [23['Play', 'Description' => 'Play video'],24['Stop', 'Description' => 'Stop video']25],26'DefaultAction' => 'Play'27))2829register_options([30Opt::RPORT(8008),31OptString.new('VID', [true, 'Video ID', 'kxopViU98Xo'])32])33end3435def run36vid = datastore['VID']3738case action.name39when 'Play'40res = play(vid)41when 'Stop'42res = stop43end4445return unless res4647case res.code48when 20149print_good("Playing https://www.youtube.com/watch?v=#{vid}")50when 20051print_status('Stopping video')52when 40453print_error('Target no longer supports casting via the DIAL protocol. ' \54'CASTV2 is not supported by this module at this time.')55end56end5758def play(vid)59begin60send_request_cgi(61'method' => 'POST',62'uri' => '/apps/YouTube',63'agent' => Rex::Text.rand_text_english(rand(42) + 1),64'vars_post' => {65'v' => vid66}67)68rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,69Rex::HostUnreachable => e70fail_with(Failure::Unreachable, e)71ensure72disconnect73end74end7576def stop77begin78send_request_raw(79'method' => 'DELETE',80'uri' => '/apps/YouTube',81'agent' => Rex::Text.rand_text_english(rand(42) + 1)82)83rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,84Rex::HostUnreachable => e85fail_with(Failure::Unreachable, e)86ensure87disconnect88end89end90end919293