From 228a15037996eac5d0604963cd9f679e780882e0 Mon Sep 17 00:00:00 2001 From: David Maloney Date: Thu, 6 Sep 2012 11:54:28 -0500 Subject: [PATCH] Built in regex support to findpids --- .../ui/console/command_dispatcher/stdapi/sys.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb index 4ce46c0e50..26e8ac17cd 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb @@ -290,6 +290,7 @@ class Console::CommandDispatcher::Stdapi::Sys if args.empty? or args.include? "-h" print_line "You must supply one or more process name to search for" print_line "e.g. findpids explorer.exe notepad.exe" + print_line "You may also pass Regular Expressions: findpids *.svc.* *.dll.*" return true end processes = client.sys.process.get_processes @@ -298,8 +299,11 @@ class Console::CommandDispatcher::Stdapi::Sys else searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new processes.each do |proc| - if args.include? proc["name"] - searched_procs << proc + args.each do |arg| + if proc["name"].match(/#{arg}/) + searched_procs << proc + break + end end end searched_procs.compact!