From 138b5d9eb00e063e2edb2c59a22faa368e7d4685 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sat, 16 Feb 2019 13:20:41 +0000 Subject: [PATCH] Add /api/server/mounts API endpoint --- core/main/rest/handlers/server.rb | 4 ++++ tools/rest_api_examples/lib/beef_rest_api.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/core/main/rest/handlers/server.rb b/core/main/rest/handlers/server.rb index 63324b674..473c7dc5f 100644 --- a/core/main/rest/handlers/server.rb +++ b/core/main/rest/handlers/server.rb @@ -50,6 +50,10 @@ module BeEF end end + get '/mounts' do + { 'mounts' => http_server.mounts }.to_json + end + get '/version' do { 'version' => config.get('beef.version') }.to_json end diff --git a/tools/rest_api_examples/lib/beef_rest_api.rb b/tools/rest_api_examples/lib/beef_rest_api.rb index 634283068..a59faeb1a 100644 --- a/tools/rest_api_examples/lib/beef_rest_api.rb +++ b/tools/rest_api_examples/lib/beef_rest_api.rb @@ -41,6 +41,18 @@ def version end end +# get server mounts +def mounts + begin + response = RestClient.get "#{@url}server/mounts", {:params => {:token => @token}} + result = JSON.parse(response.body) + print_good "Retrieved BeEF server mounts: #{result['mounts']}" + result['mounts'] + rescue => e + print_error "Could not retrieve BeEF version: #{e.message}" + end +end + # get online hooked browsers def online_browsers begin