Skip to content

Commit 228a150

Browse files
David MaloneyDavid Maloney
authored andcommitted
Built in regex support to findpids
1 parent f906aa3 commit 228a150

File tree

1 file changed

+6
-2
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi

1 file changed

+6
-2
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def cmd_findpids(*args)
290290
if args.empty? or args.include? "-h"
291291
print_line "You must supply one or more process name to search for"
292292
print_line "e.g. findpids explorer.exe notepad.exe"
293+
print_line "You may also pass Regular Expressions: findpids *.svc.* *.dll.*"
293294
return true
294295
end
295296
processes = client.sys.process.get_processes
@@ -298,8 +299,11 @@ def cmd_findpids(*args)
298299
else
299300
searched_procs = Rex::Post::Meterpreter::Extensions::Stdapi::Sys::ProcessList.new
300301
processes.each do |proc|
301-
if args.include? proc["name"]
302-
searched_procs << proc
302+
args.each do |arg|
303+
if proc["name"].match(/#{arg}/)
304+
searched_procs << proc
305+
break
306+
end
303307
end
304308
end
305309
searched_procs.compact!

0 commit comments

Comments
 (0)