Here are three ideas to consider:
- Use bgrun with search_dwld.rb
- Use file_collector.rb
- Create your own script
The best solution I can find for this is to use the command
bgrun. As the Metasploit script states,
"bgrun" => "Executes a meterpreter script as a background thread"
Bgrun executes a script in a background thread, however the
search command can't be used with
bgrun. The closest script I can find to the search command is
Search_dwld works in a similar way to
search and also downloads the files that have been found.
The usage for
search_dwld is as follows:
search_dwld -- recursively search for and download files matching a
USAGE: run search_dwld [base directory] [filter] [pattern]
filter can be a defined pattern or 'free', in which case pattern must
Examples: run search_dwld
=> recursively look for (MS|Open)Office in C:\
run search_dwld %USERPROFILE% win9x
=> recursively look for *.PWL files in the user home directory
run search_dwld E:\\ free '.(jpg|png|gif)$'
=> recursively look for pictures in the E: drive
You can use
bgrun like this:
Another option is the
file_collector script. As the link above states,
Meterpreter Script for searching and downloading files that match a
specific pattern. First save files to a file, edit and use that same
file to download the choosen files.
file_collector is a three part process. First we create the file list, then we remove any files we don't want from the list, then we execute the download process. Here is a guide on how to use
You can also use
bgrun as stated earlier with
Another alternative is to make your own script in Ruby which searches for files.
This could actually be a good solution as you can make the script fit your exact needs.