File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class Console::CommandDispatcher::Stdapi::Sys
67
67
"-h" => [ false , "Help menu." ] ,
68
68
"-A" => [ true , "Filters processes on architecture" ] ,
69
69
"-s" => [ false , "Show only SYSTEM processes" ] ,
70
+ "-c" => [ false , "Show only child processes of the current shell" ] ,
70
71
"-U" => [ true , "Filters processes on the user using the supplied RegEx" ] )
71
72
72
73
#
@@ -458,6 +459,14 @@ def cmd_ps(*args)
458
459
searched_procs << proc if proc [ "user" ] == "NT AUTHORITY\\ SYSTEM"
459
460
end
460
461
processes = searched_procs
462
+ when "-c"
463
+ print_line "Filtering on child processes of the current shell..."
464
+ current_shell_pid = client . sys . process . getpid
465
+ searched_procs = Rex ::Post ::Meterpreter ::Extensions ::Stdapi ::Sys ::ProcessList . new
466
+ processes . each do |proc |
467
+ searched_procs << proc if proc [ 'ppid' ] == current_shell_pid
468
+ end
469
+ processes = searched_procs
461
470
when "-U"
462
471
print_line "Filtering on user name..."
463
472
searched_procs = Rex ::Post ::Meterpreter ::Extensions ::Stdapi ::Sys ::ProcessList . new
You can’t perform that action at this time.
0 commit comments