Path: blob/master/modules/host/get_internal_ip_webrtc/module.rb
1154 views
#1# Copyright (c) 2006-2025 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#5class Get_internal_ip_webrtc < BeEF::Core::Command6def post_execute7content = {}8content['Result'] = @datastore['result']9save content1011configuration = BeEF::Core::Configuration.instance12return unless configuration.get('beef.extension.network.enable') == true1314return unless @datastore['results'] =~ /IP is ([\d.,]+)/1516# save the network host17ips = Regexp.last_match(1).to_s.split(/,/)18session_id = @datastore['beefhook']19if !ips.nil? && !ips.empty?20os = BeEF::Core::Models::BrowserDetails.get(session_id, 'host.os.name')21ips.uniq.each do |ip|22next unless ip =~ /^[\d.]+$/23next if ip =~ /^0\.0\.0\.0$/24next unless BeEF::Filters.is_valid_ip?(ip)2526print_debug("Hooked browser has network interface #{ip}")27BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip, os: os)28end29end30end31end323334