Moved failed beefJS split into hooked instead of into BeEFJS

This commit is contained in:
aaron
2020-04-03 14:37:48 +10:00
parent 3f59aa2d9c
commit 93ed26d10f
4 changed files with 12 additions and 24 deletions

View File

@@ -15,7 +15,7 @@ beef:
crypto_default_value_length: 80
# Testif variable
testif: false
testif: true
# Credentials to authenticate in BeEF.
# Used by both the RESTful API and the Admin interface

View File

@@ -18,6 +18,7 @@ require 'core/main/router/error_responses'
## @note Include http server functions for beef
require 'core/main/server'
require 'core/main/handlers/modules/beefjs'
require 'core/main/handlers/modules/legacybeefjs'
require 'core/main/handlers/modules/command'
require 'core/main/handlers/commands'
require 'core/main/handlers/hookedbrowsers'

View File

@@ -12,6 +12,7 @@ module Handlers
include BeEF::Core::Handlers::Modules::BeEFJS
include BeEF::Core::Handlers::Modules::LegacyBeEFJS
include BeEF::Core::Handlers::Modules::Command
#antisnatchor: we don't want to have anti-xss/anti-framing headers in the HTTP response for the hook file.
@@ -61,8 +62,11 @@ module Handlers
# @note generate the instructions to hook the browser
host_name = request.host
(print_error "Invalid host name";return) if not BeEF::Filters.is_valid_hostname?(host_name)
build_beefjs!(host_name)
if config.get("beef.testif")
build_beefjs!(host_name)
else
legacy_build_beefjs!(host_name)
end
# @note is a known browser so send instructions
else
# @note Check if we haven't seen this browser for a while, log an event if we haven't

View File

@@ -11,42 +11,25 @@ module BeEF
# @note Purpose: avoid rewriting several times the same code.
module BeEFJS
# Builds the default beefjs library (all default components of the library).
# @param [Object] req_host The request object
def build_beefjs!(req_host)
config = BeEF::Core::Configuration.instance
if config.get("beef.testif")
print("beefnew")
else
legacy = BeEF::Core::Handlers::Modules::LegacyBeEFJS
legacy.legacy_build_beefjs!(req_host)
end
print("beefnew")
end
# Finds the path to js components
# @param [String] component Name of component
# @return [String|Boolean] Returns false if path was not found, otherwise returns component path
def find_beefjs_component_path(component)
config = BeEF::Core::Configuration.instance
if config.get("beef.testif")
print("beefnew")
else
legacy = BeEF::Core::Handlers::Modules::LegacyBeEFJS
legacy.legacy_find_beefjs_component_path(component)
end
print("beefnew")
end
# Builds missing beefjs components.
# @param [Array] beefjs_components An array of component names
def build_missing_beefjs_components(beefjs_components)
config = BeEF::Core::Configuration.instance
if config.get("beef.testif")
print("beefnew")
else
legacy = BeEF::Core::Handlers::Modules::LegacyBeEFJS
legacy.legacy_build_missing_beefjs_components(beefjs_components)
end
end
end
end