|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit4 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Exploit::Remote::HttpClient |
| 11 | + |
| 12 | + def initialize(info = {}) |
| 13 | + super(update_info(info, |
| 14 | + 'Name' => 'Amazon Fire TV YouTube Remote Control', |
| 15 | + 'Description' => %q{ |
| 16 | + This module acts as a simple remote control for the Amazon Fire TV's |
| 17 | + YouTube app. |
| 18 | +
|
| 19 | + Tested on the Amazon Fire TV Stick. |
| 20 | + }, |
| 21 | + 'Author' => ['wvu'], |
| 22 | + 'References' => [ |
| 23 | + ['URL', 'http://www.amazon.com/dp/B00CX5P8FC?_encoding=UTF8&showFS=1'], |
| 24 | + ['URL', 'http://www.amazon.com/dp/B00GDQ0RMG/ref=fs_ftvs'] |
| 25 | + ], |
| 26 | + 'License' => MSF_LICENSE, |
| 27 | + 'Actions' => [ |
| 28 | + ['Play', 'Description' => 'Play video'], |
| 29 | + ['Stop', 'Description' => 'Stop video'] |
| 30 | + ], |
| 31 | + 'DefaultAction' => 'Play' |
| 32 | + )) |
| 33 | + |
| 34 | + register_options([ |
| 35 | + Opt::RPORT(8008), |
| 36 | + OptString.new('VID', [true, 'Video ID', 'HkhSZyYmpO4']) |
| 37 | + ]) |
| 38 | + end |
| 39 | + |
| 40 | + def run |
| 41 | + case action.name |
| 42 | + when 'Play' |
| 43 | + stop |
| 44 | + sleep(1) |
| 45 | + res = play |
| 46 | + when 'Stop' |
| 47 | + res = stop |
| 48 | + end |
| 49 | + |
| 50 | + return unless res |
| 51 | + |
| 52 | + case res.code |
| 53 | + when 201 |
| 54 | + print_good("Playing https://www.youtube.com/watch?v=#{datastore['VID']}") |
| 55 | + when 200 |
| 56 | + print_status('Stopping video') |
| 57 | + when 404 |
| 58 | + print_error("Couldn't #{action.name.downcase} video") |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + def play |
| 63 | + begin |
| 64 | + send_request_cgi( |
| 65 | + 'method' => 'POST', |
| 66 | + 'uri' => '/apps/YouTube', |
| 67 | + 'ctype' => 'text/plain', |
| 68 | + 'vars_post' => { |
| 69 | + 'v' => datastore['VID'] |
| 70 | + } |
| 71 | + ) |
| 72 | + rescue Rex::ConnectionRefused, Rex::ConnectionTimeout, |
| 73 | + Rex::HostUnreachable => e |
| 74 | + fail_with(Failure::Unreachable, e) |
| 75 | + end |
| 76 | + end |
| 77 | + |
| 78 | + def stop |
| 79 | + begin |
| 80 | + send_request_raw( |
| 81 | + 'method' => 'DELETE', |
| 82 | + 'uri' => '/apps/YouTube/run' |
| 83 | + ) |
| 84 | + rescue Rex::ConnectionRefused, Rex::ConnectionTimeout, |
| 85 | + Rex::HostUnreachable => e |
| 86 | + fail_with(Failure::Unreachable, e) |
| 87 | + end |
| 88 | + end |
| 89 | + |
| 90 | +end |
0 commit comments