I'm trying to add a meterpreter plugin,

a = client.railgun.kernel32.GetLogicalDrives()["return"] 
# Math magic to convert the binary to letters 
drives = [] 
(0..25).each do |i| 
    test = letters[i,1] 
    rem = a % (2**(i+1)) 
    if rem > 0 
        drives << test 
        a = a - rem 
print_line("Drives Available = #{drives.inspect}")

So I placed the file to /lib/rex/post/meterpreter/ui/console/command_dispatcher

Then I restarted msfconsole, but after successfully exploitation, I could not see the XXX command (where the filename is XXX.rb) and the use XXX command seems to be looking for a dll with that name

So what's the correct way to add a plugin for meterpreter?

1 Answer 1


The correct folder to put your script into is scripts/meterpreter/.

Once you copied your script there and launched msfconsole, you can use the run scriptname command to run it.

You can find more details and examples about meterpreter scripting on Metasploit Unleashed. A list of some useful API functions when writing such scripts can be found here and some functions examples here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .