diff --git a/core/main/handlers/commands.rb b/core/main/handlers/commands.rb index f6f935710..b5a6e48c1 100644 --- a/core/main/handlers/commands.rb +++ b/core/main/handlers/commands.rb @@ -32,22 +32,21 @@ module Handlers beefhook = get_param(@data, 'beefhook') raise WEBrick::HTTPStatus::BadRequest, "beefhook is invalid" if not BeEF::Filters.is_valid_hook_session_id?(beefhook) - @guard.synchronize { - # create the command module to handle the response - command = @kclass.new # create the commamd module - command.build_callback_datastore(@http_params, @http_header) # build datastore from the response - command.session_id = beefhook - command.callback # call the command module's callback function - it will parse and save the results + # create the command module to handle the response + command = @kclass.new # create the commamd module + command.build_callback_datastore(@http_params, @http_header) # build datastore from the response + command.session_id = beefhook + command.callback # call the command module's callback function - it will parse and save the results + + # get/set details for datastore and log entry + command_friendly_name = command.friendlyname + raise WEBrick::HTTPStatus::BadRequest, "command friendly name empty" if command_friendly_name.empty? + command_results = get_param(@data, 'results') + raise WEBrick::HTTPStatus::BadRequest, "command results empty" if command_results.empty? + # save the command module results to the datastore and create a log entry + command_results = {'type' => command_results.class, 'data' => command_results} + BeEF::Core::Models::Command.save_result(beefhook, command_id, command_friendly_name, command_results) - # get/set details for datastore and log entry - command_friendly_name = command.friendlyname - raise WEBrick::HTTPStatus::BadRequest, "command friendly name empty" if command_friendly_name.empty? - command_results = get_param(@data, 'results') - raise WEBrick::HTTPStatus::BadRequest, "command results empty" if command_results.empty? - # save the command module results to the datastore and create a log entry - command_results = {'type' => command_results.class, 'data' => command_results} - BeEF::Core::Models::Command.save_result(beefhook, command_id, command_friendly_name, command_results) - } end def get_param(query, key) diff --git a/extensions/admin_ui/handlers/ui.rb b/extensions/admin_ui/handlers/ui.rb index 040e97e92..a1b3e44de 100644 --- a/extensions/admin_ui/handlers/ui.rb +++ b/extensions/admin_ui/handlers/ui.rb @@ -28,10 +28,9 @@ module Handlers @response = response controller = nil - @guard.synchronize { - controller = @klass.new - controller.run(@request, @response) - } + + controller = @klass.new + controller.run(@request, @response) response.header.replace(controller.headers) response.body = controller.body.to_s diff --git a/extensions/initialization/handler.rb b/extensions/initialization/handler.rb index 860499607..a57ae9519 100644 --- a/extensions/initialization/handler.rb +++ b/extensions/initialization/handler.rb @@ -30,9 +30,8 @@ module Initialization zombie = BeEF::Core::Models::HookedBrowser.new(:ip => @data['request'].peeraddr[3], :session => session_id) zombie.firstseen = Time.new.to_i zombie.httpheaders = @data['request'].header.to_json - @guard.synchronize { - zombie.save # the save needs to be conducted before any hooked browser specific logging - } + + zombie.save # the save needs to be conducted before any hooked browser specific logging # add a log entry for the newly hooked browser log_zombie_domain = zombie.domain diff --git a/extensions/initialization/models/browserdetails.rb b/extensions/initialization/models/browserdetails.rb index 2c1d38bdb..ef04b3da4 100644 --- a/extensions/initialization/models/browserdetails.rb +++ b/extensions/initialization/models/browserdetails.rb @@ -52,11 +52,9 @@ module Models :detail_key => detail_key, :detail_value => detail_value) - @@guard.synchronize { - result = browserdetails.save - # if the attempt to save the browser details fails return a bad request - raise WEBrick::HTTPStatus::BadRequest, "Failed to save browser details" if result.nil? - } + result = browserdetails.save + # if the attempt to save the browser details fails return a bad request + raise WEBrick::HTTPStatus::BadRequest, "Failed to save browser details" if result.nil? browserdetails end diff --git a/extensions/requester/handler.rb b/extensions/requester/handler.rb index 8109a950f..0c25d4251 100644 --- a/extensions/requester/handler.rb +++ b/extensions/requester/handler.rb @@ -46,12 +46,10 @@ module Requester body = @data['results'] || nil raise WEBrick::HTTPStatus::BadRequest, "body is null" if body.nil? - @guard.synchronize { - # save the results in the database - http_db.response = body - http_db.has_ran = true - http_db.save - } + # save the results in the database + http_db.response = body + http_db.has_ran = true + http_db.save end