Updated the code to be compatible with Rack3

This commit is contained in:
zinduolis
2025-09-09 21:21:24 +10:00
parent d05ff08dbc
commit 5cf691120f
3 changed files with 12 additions and 3 deletions

View File

@@ -71,7 +71,12 @@ module BeEF
# @note get zombie if already hooked the framework
hook_session_name = config.get('beef.http.hook_session_name')
hook_session_id = request[hook_session_name]
hook_session_id =
if request.respond_to?(:[])
request[hook_session_name]
else
request.params[hook_session_name] || request.env[hook_session_name]
end
begin
raise ActiveRecord::RecordNotFound if hook_session_id.nil?

View File

@@ -70,7 +70,11 @@ module BeEF
res = JSON.parse(b64).first
res['beefhook'] = packet[:beefhook]
res['request'] = request
res['beefsession'] = request[BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')]
session_key = BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')
res['beefsession'] = request.cookies[session_key] ||
request.params[session_key] ||
request.env[session_key]
execute(res)
rescue JSON::ParserError => e
print_debug 'Network stack could not decode packet stream.'