From 23685694ad712c885d4a9521143459d6ca113e5d Mon Sep 17 00:00:00 2001 From: sinn3r Date: Sun, 22 Mar 2015 21:04:37 -0500 Subject: [PATCH] The tags column should be a virtual column --- lib/msf/ui/console/command_dispatcher/db.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index f1c5fcc62f..0b96ffa0ef 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -326,9 +326,9 @@ class Db output = nil default_columns = ::Mdm::Host.column_names.sort default_columns << 'tags' # Special case - virtual_columns = [ 'svcs', 'vulns', 'workspace' ] + virtual_columns = [ 'svcs', 'vulns', 'workspace', 'tags' ] - col_search = [ 'address', 'mac', 'name', 'os_name', 'os_flavor', 'os_sp', 'purpose', 'info', 'comments', 'tags'] + col_search = [ 'address', 'mac', 'name', 'os_name', 'os_flavor', 'os_sp', 'purpose', 'info', 'comments'] default_columns.delete_if {|v| (v[-2,2] == "id")} while (arg = args.shift) @@ -469,13 +469,13 @@ class Db when "svcs"; host.services.length when "vulns"; host.vulns.length when "workspace"; host.workspace.name + when "tags" + found_tags = Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ?", framework.db.workspace.id, host.address).order("tags.id DESC") + tag_names = [] + found_tags.each {|t| tag_names << t.name} + found_tags * ", " end # Otherwise, it's just an attribute - elsif n == 'tags' - found_tags = Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ?", framework.db.workspace.id, host.address).order("tags.id DESC") - tag_names = [] - found_tags.each {|t| tag_names << t.name} - found_tags * ", " else host.attributes[n] || "" end