Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/network/internal_network_fingerprinting/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
7
class Internal_network_fingerprinting < BeEF::Core::Command
8
def self.options
9
[
10
{ 'name' => 'ipRange', 'ui_label' => 'Scan IP range (C class)', 'value' => '192.168.0.1-192.168.0.254' },
11
{ 'name' => 'ports', 'ui_label' => 'Ports to test', 'value' => '80,8080' },
12
{ 'name' => 'threads', 'ui_label' => 'Workers', 'value' => '3' },
13
{ 'name' => 'wait', 'ui_label' => 'Wait (s) between each request for each worker', 'value' => '5' },
14
{ 'name' => 'timeout', 'ui_label' => 'Timeout for each request (s)', 'value' => '10' }
15
]
16
end
17
18
def post_execute
19
content = {}
20
content['discovered'] = @datastore['discovered'] unless @datastore['discovered'].nil?
21
content['url'] = @datastore['url'] unless @datastore['url'].nil?
22
content['fail'] = 'No devices/applications have been discovered.' if content.empty?
23
save content
24
25
configuration = BeEF::Core::Configuration.instance
26
return unless configuration.get('beef.extension.network.enable') == true && (@datastore['results'] =~ /^proto=(.+)&ip=(.+)&port=(\d+)&discovered=(.+)&url=(.+)/)
27
28
proto = Regexp.last_match(1)
29
ip = Regexp.last_match(2)
30
port = Regexp.last_match(3)
31
discovered = Regexp.last_match(4)
32
url = Regexp.last_match(5)
33
session_id = @datastore['beefhook']
34
if BeEF::Filters.is_valid_ip?(ip)
35
print_debug("Hooked browser found '#{discovered}' [ip: #{ip}]")
36
BeEF::Core::Models::NetworkService.create(hooked_browser_id: session_id, proto: proto, ip: ip, port: port, type: discovered)
37
end
38
end
39
end
40
41