Module: RemotePayloadDataService

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

Constant Summary collapse

PAYLOAD_API_PATH =
'/api/v1/payloads'
PAYLOAD_MDM_CLASS =
'Mdm::Payload'

Instance Method Summary collapse

Methods included from ResponseDataHelper

#json_to_hash, #json_to_mdm_object, #process_file, #to_ar

Instance Method Details

#create_payload(opts) ⇒ Object



14
15
16
# File 'lib/metasploit/framework/data_service/remote/http/remote_payload_data_service.rb', line 14

def create_payload(opts)
  json_to_mdm_object(self.post_data(PAYLOAD_API_PATH, opts), PAYLOAD_MDM_CLASS).first
end

#delete_payload(opts) ⇒ Object



27
28
29
# File 'lib/metasploit/framework/data_service/remote/http/remote_payload_data_service.rb', line 27

def delete_payload(opts)
  json_to_mdm_object(self.delete_data(PAYLOAD_API_PATH, opts), PAYLOAD_MDM_CLASS)
end

#payloads(opts) ⇒ Object



9
10
11
12
# File 'lib/metasploit/framework/data_service/remote/http/remote_payload_data_service.rb', line 9

def payloads(opts)
  path = get_path_select(opts, PAYLOAD_API_PATH)
  json_to_mdm_object(self.get_data(path, nil, opts), PAYLOAD_MDM_CLASS)
end

#update_payload(opts) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/metasploit/framework/data_service/remote/http/remote_payload_data_service.rb', line 18

def update_payload(opts)
  path = PAYLOAD_API_PATH
  if opts && opts[:id]
    id = opts.delete(:id)
    path = "#{PAYLOAD_API_PATH}/#{id}"
  end
  json_to_mdm_object(self.put_data(path, opts), PAYLOAD_MDM_CLASS)
end