Class: Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList
- Inherits:
-
Array
- Object
- Array
- Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList
- Defined in:
- lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb
Overview
Simple wrapper class for storing processes
Instance Method Summary collapse
-
#to_table(opts = {}) ⇒ Object
Create a Rex::Text::Table out of the processes stored in this list.
Instance Method Details
#to_table(opts = {}) ⇒ Object
Create a Rex::Text::Table out of the processes stored in this list
opts
is passed on to Rex::Text::Table.new, mostly unmolested
Note that this output is affected by Rex::Post::Meterpreter::Client#unicode_filter_encode
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb', line 443 def to_table(opts={}) if empty? return Rex::Text::Table.new(opts) end column_headers = [ "PID", "PPID", "Name", "Arch", "Session", "User", "Path" ] column_headers.delete_if do |h| none? { |process| process.has_key?(h.downcase) } || all? { |process| process[h.downcase].nil? } end opts = { 'Header' => 'Process List', 'Indent' => 1, 'Columns' => column_headers }.merge(opts) tbl = Rex::Text::Table.new(opts) each do |process| tbl << column_headers.map do |header| col = header.downcase next unless process.keys.any? { |process_header| process_header == col } val = process[col] if col == 'session' val == 0xFFFFFFFF ? '' : val.to_s else val end end end tbl end |