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 # ...