Skip to content
Browse files

Built in regex support to findpids

  • Loading branch information...
1 parent f906aa3 commit 228a15037996eac5d0604963cd9f679e780882e0 @dmaloney-r7 dmaloney-r7 committed Sep 6, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb
View
8 lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb
@@ -290,6 +290,7 @@ def cmd_findpids(*args)
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 @@ def cmd_findpids(*args)
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!

0 comments on commit 228a150

Please sign in to comment.
Something went wrong with that request. Please try again.