From ac49a53814223345e5c957748ff997661946873b Mon Sep 17 00:00:00 2001 From: Josh Crew Date: Mon, 20 Jan 2020 10:54:19 +0000 Subject: [PATCH 1/2] update the destroy to destroy all --- core/main/rest/handlers/hookedbrowsers.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/main/rest/handlers/hookedbrowsers.rb b/core/main/rest/handlers/hookedbrowsers.rb index 91b9e5f49..3c354e6f7 100644 --- a/core/main/rest/handlers/hookedbrowsers.rb +++ b/core/main/rest/handlers/hookedbrowsers.rb @@ -41,30 +41,30 @@ module BeEF error 401 unless hb != nil details = BeEF::Core::Models::BrowserDetails.where(:session_id => hb.session) - details.destroy + details.destroy_all logs = BeEF::Core::Models::Log.where(:hooked_browser_id => hb.id) - logs.destroy + logs.destroy_all commands = BeEF::Core::Models::Command.where(:hooked_browser_id => hb.id) - commands.destroy + commands.destroy_all results = BeEF::Core::Models::Result.where(:hooked_browser_id => hb.id) - results.destroy + results.destroy_all begin requester = BeEF::Core::Models::Http.where(:hooked_browser_id => hb.id) - requester.destroy + requester.destroy_all rescue => e #the requester module may not be enabled end begin xssraysscans = BeEF::Core::Models::Xssraysscan.where(:hooked_browser_id => hb.id) - xssraysscans.destroy + xssraysscans.destroy_all xssraysdetails = BeEF::Core::Models::Xssraysdetail.where(:hooked_browser_id => hb.id) - xssraysdetails.destroy + xssraysdetails.destroy_all rescue => e #the xssraysscan module may not be enabled end From fb5e90c4995a8d8d2cfea28ca217364cdfaeb42c Mon Sep 17 00:00:00 2001 From: josh Date: Thu, 23 Jan 2020 02:14:19 +0000 Subject: [PATCH 2/2] browser details --- .../main/handlers/browser_details_handler_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/beef/core/main/handlers/browser_details_handler_spec.rb b/spec/beef/core/main/handlers/browser_details_handler_spec.rb index c89f1ebc2..c3d295700 100644 --- a/spec/beef/core/main/handlers/browser_details_handler_spec.rb +++ b/spec/beef/core/main/handlers/browser_details_handler_spec.rb @@ -72,5 +72,14 @@ RSpec.describe 'Browser details handler' do end - + + it 'can successfully hook a browser' do + @token = BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BEEF_USER, BEEF_PASSWD).auth()[:token] + victim = BeefTest.new_victim + sleep(3) + response = RestClient.get "#{RESTAPI_HOOKS}", {:params => {:token => @token}} + x = JSON.parse(response.body) + puts x + expect(x) + end end