Skip to content

Commit 38382bb

Browse files
committed
Convert workspace command to Rex::Text::Table
Still can't get over how it's called "loots." :D
1 parent b86c1f0 commit 38382bb

File tree

1 file changed

+23
-3
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+23
-3
lines changed

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,31 @@ def cmd_workspace(*args)
177177
return
178178
end
179179
else
180+
workspace = framework.db.workspace
181+
col_names = %w{current name hosts services vulns creds loots notes}
182+
183+
tbl = Rex::Text::Table.new(
184+
'Header' => 'Workspaces',
185+
'Columns' => col_names,
186+
'SortIndex' => 1
187+
)
188+
180189
# List workspaces
181-
framework.db.workspaces.each do |s|
182-
pad = (s.name == framework.db.workspace.name) ? "* " : " "
183-
print_line("#{pad}#{s.name}")
190+
framework.db.workspaces.each do |ws|
191+
tbl << [
192+
ws == workspace ? '*' : '',
193+
ws.name,
194+
ws.hosts.count,
195+
ws.services.count,
196+
ws.vulns.count,
197+
ws.core_credentials.count,
198+
ws.loots.count,
199+
ws.notes.count
200+
]
184201
end
202+
203+
print_line
204+
print_line(tbl.to_s)
185205
end
186206
}
187207
end

0 commit comments

Comments
 (0)