Module: RemoteLootDataService
Constant Summary
collapse
- LOOT_API_PATH =
'/api/v1/loots'
- LOOT_MDM_CLASS =
'Mdm::Loot'
Instance Method Summary
collapse
#json_to_hash, #json_to_mdm_object, #process_file, #to_ar
Instance Method Details
#delete_loot(opts) ⇒ Object
43
44
45
|
# File 'lib/metasploit/framework/data_service/remote/http/remote_loot_data_service.rb', line 43
def delete_loot(opts)
json_to_mdm_object(self.delete_data(LOOT_API_PATH, opts), LOOT_MDM_CLASS)
end
|
#loot(opts = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/metasploit/framework/data_service/remote/http/remote_loot_data_service.rb', line 9
def loot(opts = {})
path = get_path_select(opts, LOOT_API_PATH)
data = self.get_data(path, nil, opts)
rv = json_to_mdm_object(data, LOOT_MDM_CLASS)
parsed_body = JSON.parse(data.response.body, symbolize_names: true)
data = Array.wrap(parsed_body[:data])
data.each do |loot|
if loot[:data] && !loot[:data].empty?
local_path = File.join(Msf::Config.loot_directory, File.basename(loot[:path]))
rv[data.index(loot)].path = process_file(loot[:data], local_path)
rv[data.index(loot)].data = decode_loot_data(loot[:data])
end
if loot[:host]
host_object = to_ar(RemoteHostDataService::HOST_MDM_CLASS.constantize, loot[:host])
rv[data.index(loot)].host = host_object
end
end
rv
end
|
#report_loot(opts) ⇒ Object
30
31
32
|
# File 'lib/metasploit/framework/data_service/remote/http/remote_loot_data_service.rb', line 30
def report_loot(opts)
json_to_mdm_object(self.post_data(LOOT_API_PATH, opts), LOOT_MDM_CLASS).first
end
|
#update_loot(opts) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/metasploit/framework/data_service/remote/http/remote_loot_data_service.rb', line 34
def update_loot(opts)
path = LOOT_API_PATH
if opts && opts[:id]
id = opts.delete(:id)
path = "#{LOOT_API_PATH}/#{id}"
end
json_to_mdm_object(self.put_data(path, opts), LOOT_MDM_CLASS)
end
|