Skip to content

Commit 699da8d

Browse files
committed
Land rapid7#7746, chromecast_wifi now uses Scanner
2 parents 10e419e + a3e8cfd commit 699da8d

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

modules/auxiliary/gather/chromecast_wifi.rb renamed to modules/auxiliary/scanner/http/chromecast_wifi.rb

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class MetasploitModule < Msf::Auxiliary
99

1010
include Msf::Exploit::Remote::HttpClient
11+
include Msf::Auxiliary::Scanner
1112

1213
def initialize(info = {})
1314
super(update_info(info,
@@ -24,16 +25,16 @@ def initialize(info = {})
2425

2526
register_options([
2627
Opt::RPORT(8008)
27-
], self.class)
28+
])
2829
end
2930

30-
def run
31+
def run_host(ip)
3132
res = scan
3233

3334
return unless res && res.code == 200
3435

35-
waps = Rex::Text::Table.new(
36-
'Header' => 'Wireless Access Points',
36+
waps_table = Rex::Text::Table.new(
37+
'Header' => "Wireless Access Points from #{ip}",
3738
'Columns' => [
3839
'BSSID',
3940
'PWR',
@@ -46,7 +47,7 @@ def run
4647
)
4748

4849
JSON.parse(res.body).each do |wap|
49-
waps << [
50+
waps_table << [
5051
wap['bssid'],
5152
wap['signal_level'],
5253
enc(wap),
@@ -56,35 +57,29 @@ def run
5657
]
5758
end
5859

59-
print_line(waps.to_s)
60-
61-
report_note(
62-
:host => rhost,
63-
:port => rport,
64-
:proto => 'tcp',
65-
:type => 'chromecast.wifi',
66-
:data => waps.to_csv
67-
)
60+
unless waps_table.rows.empty?
61+
print_line(waps_table.to_s)
62+
report_note(
63+
:host => ip,
64+
:port => rport,
65+
:proto => 'tcp',
66+
:type => 'chromecast.wifi',
67+
:data => waps_table.to_csv
68+
)
69+
end
6870
end
6971

7072
def scan
71-
begin
72-
send_request_raw(
73-
'method' => 'POST',
74-
'uri' => '/setup/scan_wifi',
75-
'agent' => Rex::Text.rand_text_english(rand(42) + 1)
76-
)
77-
send_request_raw(
78-
'method' => 'GET',
79-
'uri' => '/setup/scan_results',
80-
'agent' => Rex::Text.rand_text_english(rand(42) + 1)
81-
)
82-
rescue Rex::ConnectionRefused, Rex::ConnectionTimeout,
83-
Rex::HostUnreachable => e
84-
fail_with(Failure::Unreachable, e)
85-
ensure
86-
disconnect
87-
end
73+
send_request_raw(
74+
'method' => 'POST',
75+
'uri' => '/setup/scan_wifi',
76+
'agent' => Rex::Text.rand_text_english(rand(42) + 1)
77+
)
78+
send_request_raw(
79+
'method' => 'GET',
80+
'uri' => '/setup/scan_results',
81+
'agent' => Rex::Text.rand_text_english(rand(42) + 1)
82+
)
8883
end
8984

9085
def enc(wap)

0 commit comments

Comments
 (0)