Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/network/jslanscanner/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 Fingerprint_routers < BeEF::Core::Command
8
def self.options
9
[]
10
end
11
12
def post_execute
13
content = {}
14
content['results'] = @datastore['results'] unless @datastore['results'].nil?
15
save content
16
17
configuration = BeEF::Core::Configuration.instance
18
return unless configuration.get('beef.extension.network.enable') == true
19
20
case @datastore['results']
21
when /^proto=(.+)&ip=(.+)&port=(\d+)&service=(.+)/
22
proto = Regexp.last_match(1)
23
ip = Regexp.last_match(2)
24
port = Regexp.last_match(3)
25
service = Regexp.last_match(4)
26
session_id = @datastore['beefhook']
27
if BeEF::Filters.is_valid_ip?(ip)
28
print_debug("Hooked browser found network service #{service} [proto: #{proto}, ip: #{ip}, port: #{port}]")
29
BeEF::Core::Models::NetworkService.create(hooked_browser_id: session_id, proto: proto, ip: ip, port: port, type: service)
30
end
31
when /^ip=(.+)&device=(.+)/
32
ip = Regexp.last_match(1)
33
device = Regexp.last_match(2)
34
session_id = @datastore['beefhook']
35
if BeEF::Filters.is_valid_ip?(ip)
36
print_debug("Hooked browser found network device #{device} [ip: #{ip}]")
37
BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip, type: device)
38
end
39
end
40
end
41
end
42
43