How to do it...

Adding a new DLL definition to Railgun is an easy task. Suppose you want to add a DLL that ships with Windows, but is not present in your Railgun; you can create a DLL definition under /usr/share/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/railgun/def, select the Linux, macOS, or Windows operating system folder, and name it def_dllname.rb

The following template should demonstrate how a DLL is defined:

# -*- coding: binary -*-module Rexmodule Postmodule Meterpretermodule Extensionsmodule Stdapimodule Railgunmodule Defclass Def_somedll  def self.create_dll(dll_path = 'somedll')    dll = DLL.new(dll_path, ApiConstants.manager)    # 1st argument = Name of the function    # 2nd argument = Return value's data type # ...

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.