Path: blob/master/modules/auxiliary/admin/firetv/firetv_youtube.rb
19567 views
##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(10update_info(11info,12'Name' => 'Amazon Fire TV YouTube Remote Control',13'Description' => %q{14This module acts as a simple remote control for the Amazon Fire TV's15YouTube app.1617Tested on the Amazon Fire TV Stick.18},19'Author' => ['wvu'],20'References' => [21['URL', 'http://http://web.archive.org/web/20210301101536/http://www.amazon.com/dp/B00CX5P8FC/?_encoding=UTF8'],22['URL', 'https://www.amazon.com/dp/B00GDQ0RMG/ref=fs_ftvs']23],24'License' => MSF_LICENSE,25'Actions' => [26['Play', { 'Description' => 'Play video' }],27['Stop', { 'Description' => 'Stop video' }]28],29'DefaultAction' => 'Play',30'Notes' => {31'Stability' => [CRASH_SAFE],32'SideEffects' => [IOC_IN_LOGS, SCREEN_EFFECTS],33'Reliability' => []34}35)36)3738register_options([39Opt::RPORT(8008),40OptString.new('VID', [true, 'Video ID', 'kxopViU98Xo'])41])42end4344def run45case action.name46when 'Play'47stop48sleep(1)49res = play50when 'Stop'51res = stop52end5354return unless res5556case res.code57when 20158print_good("Playing https://www.youtube.com/watch?v=#{datastore['VID']}")59when 20060print_status('Stopping video')61when 40462print_error("Couldn't #{action.name.downcase} video")63end64end6566def play67send_request_cgi(68'method' => 'POST',69'uri' => '/apps/YouTube',70'ctype' => 'text/plain',71'vars_post' => {72'v' => datastore['VID']73}74)75rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,76Rex::HostUnreachable => e77fail_with(Failure::Unreachable, e)78end7980def stop81send_request_raw(82'method' => 'DELETE',83'uri' => '/apps/YouTube/run'84)85rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,86Rex::HostUnreachable => e87fail_with(Failure::Unreachable, e)88end89end909192