Built in regex support to findpids

unstable
David Maloney 2012-09-06 11:54:28 -05:00
parent f906aa3884
commit 228a150379
1 changed files with 6 additions and 2 deletions

View File

@ -290,6 +290,7 @@ class Console::CommandDispatcher::Stdapi::Sys
if args.empty? or args.include? "-h" if args.empty? or args.include? "-h"
print_line "You must supply one or more process name to search for" print_line "You must supply one or more process name to search for"
print_line "e.g. findpids explorer.exe notepad.exe" print_line "e.g. findpids explorer.exe notepad.exe"
print_line "You may also pass Regular Expressions: findpids *.svc.* *.dll.*"
return true return true
end end
processes = client.sys.process.get_processes processes = client.sys.process.get_processes
@ -298,8 +299,11 @@ class Console::CommandDispatcher::Stdapi::Sys
else else
searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new
processes.each do |proc| processes.each do |proc|
if args.include? proc["name"] args.each do |arg|
searched_procs << proc if proc["name"].match(/#{arg}/)
searched_procs << proc
break
end
end end
end end
searched_procs.compact! searched_procs.compact!