Skip to content

Conversation

@icamys
Copy link

@icamys icamys commented Mar 10, 2020

Closes #1878.

@jcrew99
Copy link
Contributor

jcrew99 commented Apr 24, 2020

@icamys That looks interesting, are you able to a rspec test for this before we can merge it?

@icamys
Copy link
Author

icamys commented Apr 24, 2020

@jcrew99 Actually, I've created the pull request with zero-knowledge of ruby, so, unfortunately, I'm not familiar with rspec or any other ruby-related tools.

Comment on lines +48 to +59
excluded_hooking_subnet = config.get('beef.restrictions.excluded_hooking_subnet')
unless excluded_hooking_subnet.nil? || excluded_hooking_subnet.empty?
found = true
excluded_hooking_subnet.each do |subnet|
found = false if IPAddr.new(subnet).include?(request.ip)
end

unless found
BeEF::Core::Logger.instance.register('Target Range', "Attempted hook from excluded hooking subnet (#{request.ip}) rejected.")
error 404
end
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for found is inverted, which is especially confusing to read with the final unless conditional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed changes recommended to @icamys in #1973. Will close this off if you're happy with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add excluded_hooking_subnet config option

4 participants