0

I'm trying to add a meterpreter plugin,

a = client.railgun.kernel32.GetLogicalDrives()["return"] 
# Math magic to convert the binary to letters 
drives = [] 
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
(0..25).each do |i| 
    test = letters[i,1] 
    rem = a % (2**(i+1)) 
    if rem > 0 
        drives << test 
        a = a - rem 
    end 
end 
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?

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.