class Nessus6::Editor
The Editor
class is for interacting with Nessus6
templates. Templates are used to create scans or policies with predefined parameters. localhost:8834/api#/resources/editor
Public Class Methods
# File lib/Nessus6/editor.rb, line 11 def initialize(client) @client = client end
Public Instance Methods
Export the given audit file.
@param type [String] The type of template to retrieve (scan or policy). @param object_id [String, Fixnum] The unique id of the object. @param file_id [String, Fixnum] The id of the file to export. @return [Hash]
# File lib/Nessus6/editor.rb, line 21 def audits(type, object_id, file_id) response = @client.get("editor/#{type}/#{object_id}/audits/#{file_id}") verify response, forbidden: 'You do not have permission to export the audit file', not_found: 'Audit file does not exist', internal_server_error: 'Internal server error occurred.' end
Returns the details for the given template.
@param type [String] The type of template to retrieve (scan or policy). @param template_uuid [String] The uuid for the template. @return [Hash] Details for the given template
# File lib/Nessus6/editor.rb, line 34 def details(type, template_uuid) response = @client.get("editor/#{type}/templates/#{template_uuid}") verify response, forbidden: 'You do not have permission to open the template', not_found: 'Template does not exist', internal_server_error: 'Internal server error occurred.' end
Returns the requested object.
@param type [String] The type of template to retrieve (scan or policy). @param id [String, Fixnum] The unique id of the object. @return [Hash] The requested object
# File lib/Nessus6/editor.rb, line 47 def edit(type, id) response = @client.get("editor/#{type}/#{id}") verify response, forbidden: 'You do not have permission to open the object', not_found: 'Object does not exist', internal_server_error: 'Internal server error occurred.' end
Returns the template list.
@param type [String] The type of template to retrieve (scan or policy). @return [Hash] { “templates”: [ template Resource ] }
# File lib/Nessus6/editor.rb, line 59 def list(type) response = @client.get("editor/#{type}/templates") verify response, bad_request: 'Request could not be completed. Please use either '\ 'type "scan" or type "policy".', forbidden: 'You do not have permission to view the list', internal_server_error: 'Internal server error occurred.' end
Returns the plugin description. This request requires standard user permissions
@param policy_id [String, Fixnum] The id of the policy to lookup. @param family_id [String, Fixnum] The id of the family to lookup within
the policy.
@param plugin_id [String, Fixnum] The id of the plugin to lookup within
the family.
@return [Hash] The plugin output
# File lib/Nessus6/editor.rb, line 77 def plugin_description(policy_id, family_id, plugin_id) response = @client.get("editor/policy/#{policy_id}/families/#{family_id}"\ "/plugins/#{plugin_id}") verify response, internal_server_error: 'Internal server error occurred.' end