How it works...

The source code for scraper.rb is present under /usr/share/metasploit-framework/scripts/meterpreter.

Coding experience in Ruby can help you in editing the scripts to add your own features. We can change the download location by editing the following line:

logs = ::File.join(Msf::Config.log_directory, 'scripts','scraper', host + "_" + Time.now.strftime("%Y%m%d.%M%S")+sprintf("%.5d",rand(100000)) )

Suppose you want to obtain the result of a list of available processes as well; you can simply add the following line of code in the main body of the program:

::File.open(File.join(logs, "process.txt"), "w") do |fd| fd.puts(m_exec(client, "tasklist")) end

By using a little bit of Ruby language and reusable code, you can easily modify ...

Get Metasploit Penetration Testing Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.