File tree Expand file tree Collapse file tree 2 files changed +36
-6
lines changed
lib/msf/ui/console/command_dispatcher
spec/lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,31 @@ def cmd_workspace(*args)
177
177
return
178
178
end
179
179
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
+
180
189
# 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
+ ]
184
201
end
202
+
203
+ print_line
204
+ print_line ( tbl . to_s )
185
205
end
186
206
}
187
207
end
Original file line number Diff line number Diff line change 546
546
it "should list default workspace" do
547
547
db . cmd_workspace
548
548
expect ( @output ) . to match_array [
549
- "* default"
549
+ "" ,
550
+ "Workspaces" ,
551
+ "==========" ,
552
+ "current name hosts services vulns creds loots notes" ,
553
+ "------- ---- ----- -------- ----- ----- ----- -----" ,
554
+ "* default 0 0 0 0 0 0"
550
555
]
551
556
end
552
557
555
560
@output = [ ]
556
561
db . cmd_workspace
557
562
expect ( @output ) . to match_array [
558
- " default" ,
559
- "* foo"
563
+ "" ,
564
+ "Workspaces" ,
565
+ "==========" ,
566
+ "current name hosts services vulns creds loots notes" ,
567
+ "------- ---- ----- -------- ----- ----- ----- -----" ,
568
+ " default 0 0 0 0 0 0" ,
569
+ "* foo 0 0 0 0 0 0"
560
570
]
561
571
end
562
572
end
You can’t perform that action at this time.
0 commit comments