Module: RemoteDbImportDataService

Includes:
ResponseDataHelper
Included in:
DataServiceAutoLoader
Defined in:
lib/metasploit/framework/data_service/remote/http/remote_db_import_data_service.rb

Constant Summary collapse

DB_IMPORT_API_PATH =
'/api/v1/db-import'

Instance Method Summary collapse

Methods included from ResponseDataHelper

#json_to_hash, #json_to_mdm_object, #process_file, #process_response, #to_ar

Instance Method Details

#import_file(opts) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/metasploit/framework/data_service/remote/http/remote_db_import_data_service.rb', line 8

def import_file(opts)
  filename = opts[:filename]
  data = ""
  File.open(filename, 'rb') do |f|
    data = f.read(f.stat.size)
  end

  opts[:data] = Base64.urlsafe_encode64(data)

  self.post_data_async(DB_IMPORT_API_PATH, opts)
end