Method: Rex::Post::Meterpreter::ClientCore#use
- Defined in:
- lib/rex/post/meterpreter/client_core.rb
#use(mod, opts = { }) ⇒ Object
Loads a meterpreter extension on the remote server instance and initializes the client-side extension handlers
Module The module that should be loaded
LoadFromDisk Indicates that the library should be loaded from disk, not from memory on the remote machine
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/rex/post/meterpreter/client_core.rb', line 260 def use(mod, opts = { }) if mod.nil? raise RuntimeError, "No modules were specified", caller end # Query the remote instance to see if commands for the extension are # already loaded commands = get_loaded_extension_commands(mod.downcase) # if there are existing commands for the given extension, then we can use # what's already there unless commands.length > 0 # Get us to the installation root and then into data/meterpreter, where # the file is expected to be modname = "ext_server_#{mod.downcase}" path = MetasploitPayloads.meterpreter_path(modname, client.binary_suffix) if opts['ExtensionPath'] path = ::File.(opts['ExtensionPath']) end if path.nil? raise RuntimeError, "No module of the name #{modname}.#{client.binary_suffix} found", caller end # Load the extension DLL commands = load_library( 'LibraryFilePath' => path, 'UploadLibrary' => true, 'Extension' => true, 'SaveToDisk' => opts['LoadFromDisk']) end # wire the commands into the client client.add_extension(mod, commands) return true end |