Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/extensions/xssrays/api.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
module BeEF
7
module Extension
8
module Xssrays
9
module RegisterHttpHandler
10
BeEF::API::Registrar.instance.register(BeEF::Extension::Xssrays::RegisterHttpHandler, BeEF::API::Server, 'mount_handler')
11
12
#
13
# Mounts the handlers and REST interface for processing XSS rays
14
#
15
# @param beef_server [BeEF::Core::Server] HTTP server instance
16
#
17
def self.mount_handler(beef_server)
18
# We register the http handler for the requester.
19
# This http handler will retrieve the http responses for all requests
20
beef_server.mount('/xssrays', BeEF::Extension::Xssrays::Handler.new)
21
# REST API endpoint
22
beef_server.mount('/api/xssrays', BeEF::Extension::Xssrays::XssraysRest.new)
23
end
24
end
25
26
module RegisterPreHookCallback
27
BeEF::API::Registrar.instance.register(BeEF::Extension::Xssrays::RegisterPreHookCallback, BeEF::API::Server::Hook, 'pre_hook_send')
28
29
# checks at every polling if there are new scans to be started
30
def self.pre_hook_send(hooked_browser, body, _params, _request, _response)
31
return if hooked_browser.nil?
32
33
xssrays = BeEF::Extension::Xssrays::API::Scan.new
34
xssrays.start_scan(hooked_browser, body)
35
end
36
end
37
end
38
end
39
end
40
41