First pass at Session Event API doc

GSoC/Meterpreter_Web_Console
James Barnett 2018-05-03 16:00:56 -05:00
parent a11c7220b6
commit 728850c61a
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
3 changed files with 66 additions and 0 deletions

View File

@ -32,6 +32,7 @@ module RootApiDoc
tag name: 'note', description: 'Note operations.'
tag name: 'service', description: 'Service operations.'
tag name: 'session', description: 'Session operations.'
tag name: 'session_event', description: 'Session Event operations.'
tag name: 'vuln', description: 'Vuln operations.'
tag name: 'workspace', description: 'Workspace operations.'

View File

@ -0,0 +1,63 @@
require 'swagger/blocks'
module SessionEventApiDoc
include Swagger::Blocks
# Swagger documentation for session events model
swagger_schema :SessionEvent do
key :required, [:id, :etype]
property :id, type: :integer, format: :int32
property :created_at, type: :string, format: :date_time
property :session_id, type: :integer, format: :int32
property :etype, type: :string
property :command, type: :string
property :output, type: :string
property :remote_path, type: :string
property :local_path, type: :string
end
swagger_path '/api/v1/session-events' do
# Swagger documentation for /api/v1/session-events GET
operation :get do
key :description, 'Return session events that are stored in the database.'
key :tags, [ 'session_event' ]
response 200 do
key :description, 'Returns session events data.'
schema do
key :type, :array
items do
key :'$ref', :SessionEvent
end
end
end
end
# Swagger documentation for /api/v1/session events POST
operation :post do
key :description, 'Create a session events entry.'
key :tags, [ 'session_event' ]
parameter do
key :in, :body
key :name, :body
key :description, 'The attributes to assign to the session.'
key :required, true
schema do
property :etype, type: :string, required: true
property :local_path, type: :string
property :command, type: :string
property :session, '$ref' => :Session, required: true
end
end
response 200 do
key :description, 'Successful operation.'
schema do
key :type, :object
key :'$ref', :SessionEvent
end
end
end
end
end

View File

@ -10,6 +10,7 @@ load 'documentation/api/v1/nmap_api_doc.rb'
load 'documentation/api/v1/note_api_doc.rb'
load 'documentation/api/v1/service_api_doc.rb'
load 'documentation/api/v1/session_api_doc.rb'
load 'documentation/api/v1/session_event_api_doc.rb'
load 'documentation/api/v1/vuln_api_doc.rb'
load 'documentation/api/v1/workspace_api_doc.rb'
@ -48,6 +49,7 @@ module ApiDocsServlet
NoteApiDoc,
ServiceApiDoc,
SessionApiDoc,
SessionEventApiDoc,
VulnApiDoc,
WorkspaceApiDoc
].freeze