Path: blob/master/modules/auxiliary/scanner/http/chromecast_wifi.rb
19593 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::HttpClient7include Msf::Auxiliary::Scanner89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Chromecast Wifi Enumeration',14'Description' => %q{15This module enumerates wireless access points through Chromecast.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'Notes' => {23'Reliability' => UNKNOWN_RELIABILITY,24'Stability' => UNKNOWN_STABILITY,25'SideEffects' => UNKNOWN_SIDE_EFFECTS26}27)28)2930register_options([31Opt::RPORT(8008)32])33end3435def run_host(ip)36res = scan3738return unless res && res.code == 2003940waps_table = Rex::Text::Table.new(41'Header' => "Wireless Access Points from #{ip}",42'Columns' => [43'BSSID',44'PWR',45'ENC',46'CIPHER',47'AUTH',48'ESSID'49],50'SortIndex' => -151)5253res.get_json_document.each do |wap|54waps_table << [55wap['bssid'],56wap['signal_level'],57enc(wap),58cipher(wap),59auth(wap),60wap['ssid'] + (wap['wpa_id'] ? ' (*)' : '')61]62end6364unless waps_table.rows.empty?65print_line(waps_table.to_s)66report_note(67:host => ip,68:port => rport,69:proto => 'tcp',70:type => 'chromecast.wifi',71:data => { :csv_table => waps_table.to_csv }72)73end74end7576def scan77send_request_raw(78'method' => 'POST',79'uri' => '/setup/scan_wifi',80'agent' => Rex::Text.rand_text_english(rand(42) + 1)81)82send_request_raw(83'method' => 'GET',84'uri' => '/setup/scan_results',85'agent' => Rex::Text.rand_text_english(rand(42) + 1)86)87end8889def enc(wap)90case wap['wpa_auth']91when 192'OPN'93when 294'WEP'95when 596'WPA'97when 0, 798'WPA2'99else100wap['wpa_auth']101end102end103104def cipher(wap)105case wap['wpa_cipher']106when 1107''108when 2109'WEP'110when 3111'TKIP'112when 4113'CCMP'114else115wap['wpa_cipher']116end117end118119def auth(wap)120case wap['wpa_auth']121when 0122'MGT'123when 5, 7124'PSK'125else126''127end128end129end130131132