Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/network/ping_sweep/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 Ping_sweep < BeEF::Core::Command
7
def post_execute
8
content = {}
9
content['result'] = @datastore['result']
10
save content
11
12
configuration = BeEF::Core::Configuration.instance
13
return unless configuration.get('beef.extension.network.enable') == true
14
15
# log the network service
16
return unless @datastore['results'] =~ /^ip=(.+)&ping=(\d+)ms$/
17
18
ip = Regexp.last_match(1)
19
# ping = Regexp.last_match(2)
20
session_id = @datastore['beefhook']
21
if BeEF::Filters.is_valid_ip?(ip)
22
print_debug("Hooked browser found host #{ip}")
23
BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: ip)
24
end
25
end
26
27
def self.options
28
[
29
{ 'name' => 'rhosts', 'ui_label' => 'Scan IP range (C class)', 'value' => 'common' },
30
{ 'name' => 'threads', 'ui_label' => 'Workers', 'value' => '3' }
31
]
32
end
33
end
34
35