Added icamys changes, inverting the logic for the found variable.

This commit is contained in:
Jack Walker
2020-07-21 11:22:47 +10:00
parent 0c07a5f853
commit dbd20a742e
2 changed files with 17 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ beef:
# subnet of IP addresses that can connect to the admin UI
#permitted_ui_subnet: ["127.0.0.1/32", "::1/128"]
permitted_ui_subnet: ["0.0.0.0/0", "::/0"]
# subnet of IP addresses that cannot be hooked by the framework
excluded_hooking_subnet: []
# slow API calls to 1 every api_attempt_delay seconds
api_attempt_delay: "0.05"

View File

@@ -33,7 +33,7 @@ module Handlers
permitted_hooking_subnet = config.get('beef.restrictions.permitted_hooking_subnet')
if permitted_hooking_subnet.nil? || permitted_hooking_subnet.empty?
BeEF::Core::Logger.instance.register('Target Range', "Attempted hook from outside of permitted hooking subnet (#{request.ip}) rejected.")
error 404
error 404
end
found = false
@@ -46,6 +46,20 @@ module Handlers
error 404
end
excluded_hooking_subnet = config.get('beef.restrictions.excluded_hooking_subnet')
unless excluded_hooking_subnet.nil? || excluded_hooking_subnet.empty?
found = false
excluded_hooking_subnet.each do |subnet|
found = true if IPAddr.new(subnet).include?(request.ip)
end
if found
BeEF::Core::Logger.instance.register('Target Range', "Attempted hook from excluded hooking subnet (#{request.ip}) rejected.")
error 404
end
end
# @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]