Module: LootDataProxy
- Included in:
- DataProxyAutoLoader
- Defined in:
- lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb
Instance Method Summary collapse
- #find_or_create_loot(opts) ⇒ Object
- #loots(opts = {}) ⇒ Object (also: #loot)
- #report_loot(opts) ⇒ Object
- #update_loot(opts) ⇒ Object
Instance Method Details
#find_or_create_loot(opts) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb', line 17 def find_or_create_loot(opts) begin # create separate opts for find operation since the report operation uses slightly different keys # TODO: standardize option keys used for the find and report operations find_opts = opts.clone # convert type to ltype find_opts[:ltype] = find_opts.delete(:type) if find_opts.key?(:type) # convert host to nested hosts address find_opts[:hosts] = {address: find_opts.delete(:host)} if find_opts.key?(:host) loot = loots(find_opts) if loot.nil? || loot.first.nil? loot = report_loot(opts.clone) else loot = loot.first end loot rescue => e self.log_error(e, "Problem finding or creating loot") end end |
#loots(opts = {}) ⇒ Object Also known as: loot
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb', line 39 def loots(opts = {}) begin self.data_service_operation do |data_service| add_opts_workspace(opts) data_service.loot(opts) end rescue => e self.log_error(e, "Problem retrieving loot") end end |
#report_loot(opts) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb', line 3 def report_loot(opts) begin self.data_service_operation do |data_service| unless data_service.is_a?(Msf::DBManager) opts[:data] = Base64.urlsafe_encode64(opts[:data].to_s) unless opts[:data].nil? end add_opts_workspace(opts) data_service.report_loot(opts) end rescue => e self.log_error(e, "Problem reporting loot") end end |
#update_loot(opts) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb', line 52 def update_loot(opts) begin self.data_service_operation do |data_service| data_service.update_loot(opts) end rescue => e self.log_error(e, "Problem updating loot") end end |