Path: blob/master/modules/host/get_internal_ip_java/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_java < BeEF::Core::Command6def pre_send7BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/host/get_internal_ip_java/get_internal_ip.class', '/get_internal_ip', 'class')8end910# def self.options11# return [12# { 'name' => 'applet_name', 'description' => 'Applet Name', 'ui_label'=>'Number', 'value' =>'5551234','width' => '200px' },13# ]14# end1516def post_execute17content = {}18content['Result'] = @datastore['result']19save content20BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/get_internal_ip.class')2122configuration = BeEF::Core::Configuration.instance23return unless configuration.get('beef.extension.network.enable') == true2425session_id = @datastore['beefhook']2627# save the network host28return unless @datastore['results'] =~ /^([\d.]+)$/2930ip = Regexp.last_match(1)31if BeEF::Filters.is_valid_ip?(ip)32print_debug("Hooked browser has network interface #{ip}")33BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip)34end35end36end373839