diff --git a/documentation/api/v1/async_callback_api_doc.rb b/documentation/api/v1/async_callback_api_doc.rb index 54f02fe46e..dc5c9523be 100644 --- a/documentation/api/v1/async_callback_api_doc.rb +++ b/documentation/api/v1/async_callback_api_doc.rb @@ -108,19 +108,20 @@ module AsyncCallbackApiDoc end end - swagger_path '/api/v1/async-callbacks/{id}' do - # Swagger documentation for api/v1/async-callbacks/:id GET + swagger_path '/api/v1/async-callbacks/{uuid}' do + # Swagger documentation for api/v1/async-callbacks/:uuid GET operation :get do key :description, 'Return specific asynchronous payload callback that is stored in the database.' key :tags, [ 'async_callback' ] + parameter :workspace + parameter do - key :name, :id + key :name, :uuid key :in, :path - key :description, 'ID of asynchronous payload callback to retrieve.' + key :description, 'UUID of asynchronous payload callback to retrieve.' key :required, true - key :type, :integer - key :format, :int32 + key :type, :string end response 200 do diff --git a/lib/msf/core/db_manager/async_callback.rb b/lib/msf/core/db_manager/async_callback.rb index dc9d0c2752..26161157bf 100644 --- a/lib/msf/core/db_manager/async_callback.rb +++ b/lib/msf/core/db_manager/async_callback.rb @@ -15,8 +15,10 @@ module Msf::DBManager::AsyncCallback def async_callbacks(opts) ::ActiveRecord::Base.connection_pool.with_connection do - if opts[:id] && !opts[:id].to_s.empty? - return Array.wrap(Mdm::AsyncCallback.find(opts[:id])) + if opts[:uuid] && !opts[:uuid].to_s.empty? + #return Array.wrap(Mdm::AsyncCallback.find_by :uuid => opts[:uuid] ) + #return Array.wrap( Mdm::AsyncCallback.where ( uuid: opts[:uuid] )) + return Mdm::AsyncCallback.where( 'uuid' => opts[:uuid] ) end wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework) diff --git a/lib/msf/core/web_services/servlet/async_callback_servlet.rb b/lib/msf/core/web_services/servlet/async_callback_servlet.rb index 40399a9f8b..3ee00e5c36 100644 --- a/lib/msf/core/web_services/servlet/async_callback_servlet.rb +++ b/lib/msf/core/web_services/servlet/async_callback_servlet.rb @@ -4,12 +4,12 @@ module AsyncCallbackServlet '/api/v1/async-callbacks' end - def self.api_path_with_id - "#{AsyncCallbackServlet.api_path}/?:id?" + def self.api_path_with_uuid + "#{AsyncCallbackServlet.api_path}/?:uuid?" end def self.registered(app) - app.get AsyncCallbackServlet.api_path_with_id, &get_async_callback + app.get AsyncCallbackServlet.api_path_with_uuid, &get_async_callback app.post AsyncCallbackServlet.api_path, &create_async_callback end