@@ -354,6 +354,8 @@ def delete_host_tag(rws, tag_name)
354
354
end
355
355
end
356
356
357
+ @@hosts_columns = [ 'address' , 'mac' , 'name' , 'os_name' , 'os_flavor' , 'os_sp' , 'purpose' , 'info' , 'comments' ]
358
+
357
359
def cmd_hosts ( *args )
358
360
return unless active?
359
361
::ActiveRecord ::Base . connection_pool . with_connection {
@@ -371,7 +373,7 @@ def cmd_hosts(*args)
371
373
default_columns << 'tags' # Special case
372
374
virtual_columns = [ 'svcs' , 'vulns' , 'workspace' , 'tags' ]
373
375
374
- col_search = [ 'address' , 'mac' , 'name' , 'os_name' , 'os_flavor' , 'os_sp' , 'purpose' , 'info' , 'comments' ]
376
+ col_search = @@hosts_columns
375
377
376
378
default_columns . delete_if { |v | ( v [ -2 , 2 ] == "id" ) }
377
379
while ( arg = args . shift )
@@ -380,7 +382,7 @@ def cmd_hosts(*args)
380
382
mode << :add
381
383
when '-d' , '--delete'
382
384
mode << :delete
383
- when '-c'
385
+ when '-c' , '-C'
384
386
list = args . shift
385
387
if ( !list )
386
388
print_error ( "Invalid column list" )
@@ -394,6 +396,10 @@ def cmd_hosts(*args)
394
396
return
395
397
end
396
398
}
399
+ if ( arg == '-C' )
400
+ @@hosts_columns = col_search
401
+ end
402
+
397
403
when '-u' , '--up'
398
404
onlyup = true
399
405
when '-o'
@@ -426,6 +432,7 @@ def cmd_hosts(*args)
426
432
print_line " -a,--add Add the hosts instead of searching"
427
433
print_line " -d,--delete Delete the hosts instead of searching"
428
434
print_line " -c <col1,col2> Only show the given columns (see list below)"
435
+ print_line " -C <col1,col2> Only show the given columns until the next restart (see list below)"
429
436
print_line " -h,--help Show this help information"
430
437
print_line " -u,--up Only show hosts which are up"
431
438
print_line " -o <file> Send output to a file in csv format"
0 commit comments