From a5b9cc8cb82db752276d0082691f79118bd16c4d Mon Sep 17 00:00:00 2001 From: James Barnett Date: Thu, 3 May 2018 17:16:04 -0500 Subject: [PATCH] Add Msf endpoint API doc --- documentation/api/v1/msf_api_doc.rb | 20 +++++++++++++++++++ documentation/api/v1/root_api_doc.rb | 1 + .../http/servlet/api_docs_servlet.rb | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 documentation/api/v1/msf_api_doc.rb diff --git a/documentation/api/v1/msf_api_doc.rb b/documentation/api/v1/msf_api_doc.rb new file mode 100644 index 0000000000..a32301b071 --- /dev/null +++ b/documentation/api/v1/msf_api_doc.rb @@ -0,0 +1,20 @@ +require 'swagger/blocks' + +module MsfApiDoc + include Swagger::Blocks + + swagger_path '/api/v1/msf' do + # Swagger documentation for /api/v1/msf GET + operation :get do + key :description, 'Return the current version of the running Metasploit Framework.' + key :tags, [ 'msf' ] + + response 200 do + key :description, 'Returns the Metasploit Framework version.' + schema do + property :metasploit_version, type: :string + end + end + end + end +end diff --git a/documentation/api/v1/root_api_doc.rb b/documentation/api/v1/root_api_doc.rb index 74a372f7c3..55a2f97a30 100644 --- a/documentation/api/v1/root_api_doc.rb +++ b/documentation/api/v1/root_api_doc.rb @@ -28,6 +28,7 @@ module RootApiDoc tag name: 'exploit', description: 'Exploit operations.' tag name: 'host', description: 'Host operations.' tag name: 'loot', description: 'Loot operations.' + tag name: 'msf', description: 'Utility operations around Metasploit Framework.' tag name: 'nmap', description: 'Nmap operations.' tag name: 'note', description: 'Note operations.' tag name: 'service', description: 'Service operations.' diff --git a/lib/msf/core/db_manager/http/servlet/api_docs_servlet.rb b/lib/msf/core/db_manager/http/servlet/api_docs_servlet.rb index 1b9dd40ec8..152431c978 100644 --- a/lib/msf/core/db_manager/http/servlet/api_docs_servlet.rb +++ b/lib/msf/core/db_manager/http/servlet/api_docs_servlet.rb @@ -6,6 +6,7 @@ load 'documentation/api/v1/event_api_doc.rb' load 'documentation/api/v1/exploit_api_doc.rb' load 'documentation/api/v1/host_api_doc.rb' load 'documentation/api/v1/loot_api_doc.rb' +load 'documentation/api/v1/msf_api_doc.rb' load 'documentation/api/v1/nmap_api_doc.rb' load 'documentation/api/v1/note_api_doc.rb' load 'documentation/api/v1/service_api_doc.rb' @@ -46,6 +47,7 @@ module ApiDocsServlet ExploitApiDoc, HostApiDoc, LootApiDoc, + MsfApiDoc, NmapApiDoc, NoteApiDoc, ServiceApiDoc,