Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/core/api/main/server.rb
1155 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
module BeEF
7
module API
8
module Server
9
# @note Defined API Paths
10
API_PATHS = {
11
'mount_handler' => :mount_handler,
12
'pre_http_start' => :pre_http_start
13
}.freeze
14
15
# Fires just before the HTTP Server is started
16
# @param [Object] http_hook_server HTTP Server object
17
def pre_http_start(http_hook_server); end
18
19
# Fires just after handlers have been mounted
20
# @param [Object] server HTTP Server object
21
def mount_handler(server); end
22
23
# Mounts a handler
24
# @param [String] url URL to be mounted
25
# @param [Class] http_handler_class the handler Class
26
# @param [Array] args an array of arguments
27
# @note This is a direct API call and does not have to be registered to be used
28
def self.mount(url, http_handler_class, args = nil)
29
BeEF::Core::Server.instance.mount(url, http_handler_class, *args)
30
end
31
32
# Unmounts a handler
33
# @param [String] url URL to be unmounted
34
# @note This is a direct API call and does not have to be registered to be used
35
def self.unmount(url)
36
BeEF::Core::Server.instance.unmount(url)
37
end
38
end
39
end
40
end
41
42