Skip to content

Commit 5b35662

Browse files
committed
Address PR comments
1 parent cb093d8 commit 5b35662

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

lib/metasploit/framework/data_service/proxy/loot_data_proxy.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def report_loot(opts)
88
end
99
data_service.report_loot(opts)
1010
rescue Exception => e
11-
elog "Call to #{data_service.class}#report_loot threw exception: #{e.message}"
11+
elog "Problem creating loot: #{e.message}"
1212
end
1313
end
1414

@@ -24,7 +24,7 @@ def loots(wspace, opts = {})
2424
opts[:wspace] = wspace
2525
data_service.loot(opts)
2626
rescue Exception => e
27-
elog "Call to #{data_service.class}#loots threw exception: #{e.message}"
27+
elog "Problem retrieving loot: #{e.message}"
2828
e.backtrace.each { |line| elog "#{line}\n" }
2929
end
3030
end
@@ -35,7 +35,7 @@ def update_loot(opts)
3535
data_service = self.get_data_service
3636
data_service.update_loot(opts)
3737
rescue Exception => e
38-
elog "Call to #{data_service.class}#update_loot threw exception: #{e.message}"
38+
elog "Problem updating loot: #{e.message}"
3939
e.backtrace.each { |line| elog "#{line}\n" }
4040
end
4141
end

lib/msf/core/db_manager/host.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def del_host(wspace, address, comm='')
99
}
1010
end
1111

12-
# Deletes Loot entries based on the IDs passed in.
12+
# Deletes Host entries based on the IDs passed in.
1313
#
1414
# @param opts[:ids] [Array] Array containing Integers corresponding to the IDs of the Loot entries to delete.
1515
# @return [Array] Array containing the Mdm::Loot objects that were successfully deleted.

lib/msf/core/db_manager/loot.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def report_loot(opts)
9191
}
9292
end
9393

94+
# Update the attributes of a Loot entry with the values in opts.
95+
# The values in opts should match the attributes to update.
96+
#
97+
# @param opts [Hash] Hash containing the updated values. Key should match the attribute to update. Must contain :id of record to update.
98+
# @return [Mdm::Loot] The updated Mdm::Loot object.
9499
def update_loot(opts)
95-
wspace = opts.delete(:workspace) || opts.delete(:wspace) || workspace
96-
if wspace.kind_of? String
97-
wspace = find_workspace(wspace)
98-
end
99-
100100
::ActiveRecord::Base.connection_pool.with_connection {
101101
id = opts.delete(:id)
102102
Mdm::Loot.update(id, opts)

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,6 @@ def cmd_hosts(*args)
650650
break if !host_search.nil? && host_search.empty?
651651

652652
framework.db.hosts(framework.db.workspace, onlyup, host_search, search_term = search_term).each do |host|
653-
# if search_term
654-
# next unless (
655-
# host.attribute_names.any? { |a| host[a.intern].to_s.match(search_term) } || !find_hosts_with_tag(framework.db.workspace.id, host.address, search_term.source).empty?
656-
# )
657-
# end
658-
659653
matched_host_ids << host.id
660654
columns = col_names.map do |n|
661655
# Deal with the special cases
@@ -1370,13 +1364,7 @@ def cmd_loot(*args)
13701364
end
13711365

13721366
loots.each do |loot|
1373-
next if(types and types.index(loot.ltype).nil?)
1374-
# if search_term
1375-
# next unless(
1376-
# loot.attribute_names.any? { |a| loot[a.intern].to_s.match(search_term) } or
1377-
# loot.host.attribute_names.any? { |a| loot.host[a.intern].to_s.match(search_term) }
1378-
# )
1379-
# end
1367+
next if types and types.index(loot.ltype).nil?
13801368
row = []
13811369
# TODO: This is just a temp implementation of update for the time being since it did not exist before.
13821370
# It should be updated to not pass all of the attributes attached to the object, only the ones being updated.

0 commit comments

Comments
 (0)