class Nessus6::File

The File class is for uploading files to Nessus. localhost:8834/api#/resources/file

Public Class Methods

new(client) click to toggle source
# File lib/Nessus6/file.rb, line 10
def initialize(client)
  @client = client
end

Public Instance Methods

upload(file_path, file_type = 'text/plain', encrypted = 0) click to toggle source

Uploads a file. This request requires read only user permissions.

@param file_path [String] Path to the file to upload @param file_type [String] MIME type. E.g. 'text/plain' @return [Hash] Returns a :fileuploaded string.

# File lib/Nessus6/file.rb, line 19
def upload(file_path, file_type = 'text/plain', encrypted = 0)
  response = @client.post('file/upload',
                          file: Hurley::UploadIO.new(file_path, file_type),
                          no_enc: encrypted)
  verify response,
         internal_server_error: 'File failed to upload'
end