Path: blob/master/modules/auxiliary/gather/browser_info.rb
19567 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::BrowserExploitServer78def initialize(info = {})9super(10update_info(11info,12'Name' => "HTTP Client Information Gather",13'Description' => %q{14This module gathers information about a browser that exploits might be interested in, such15as OS name, browser version, plugins, etc. By default, the module will return a fake 404,16but you can customize this output by changing the Custom404 datastore option, and17redirect to an external web page.18},19'License' => MSF_LICENSE,20'Author' => [ 'sinn3r' ],21'DisclosureDate' => '2016-03-22',22'Actions' => [23[24'WebServer',25'Description' => 'A web server that collects information about the browser.'26]27],28'PassiveActions' => [ 'WebServer' ],29'DefaultAction' => 'WebServer',30'Notes' => {31'Reliability' => UNKNOWN_RELIABILITY,32'Stability' => UNKNOWN_STABILITY,33'SideEffects' => UNKNOWN_SIDE_EFFECTS34}35)36)37end3839def is_key_wanted?(key)40![:module, :created_at, :tried, :vuln_test, :address].include?(key)41end4243def is_value_wanted?(value)44!(value.nil? || value =~ /^undefined|false/ || !value)45end4647def ignore_items!(target_info)48target_info.delete_if do |key, value|49!is_key_wanted?(key) || !is_value_wanted?(value)50end51end5253def report_host_info(target_info)54opts = { host: target_info[:address] }55opts.merge!(target_info)56report_host(opts)57end5859def translate_script_meaning(value)60case value61when 'script'62'Browser allows JavaScript'63when 'headers'64'Browser does not allow JavaScript'65end66end6768def print_target_info(cli, target_info)69print_good("#{cli.peerhost} - We have found the following interesting information:")70report_host_info(target_info)71ignore_items!(target_info)72target_info.each_pair do |key, value|73if key == :source74value = translate_script_meaning(value)75end76print_status("#{cli.peerhost} - #{key} = #{value}")77end78end7980def on_request_exploit(cli, req, target_info)81print_target_info(cli, target_info)82send_response(cli, '')83end8485def run86exploit87end88end899091