/** * Load an extension into this meterpreter. Called from {@link core_loadlib}. * * @param data The extension jar's content as a byte array */ public String[] loadExtension(byte[] data) throws Exception { ClassLoader classLoader = getClass().getClassLoader(); if (loadExtensions) { URL url = MemoryBufferURLConnection.createURL(data, "application/jar"); classLoader = new URLClassLoader(new URL[] {url}, classLoader); } JarInputStream jis = new JarInputStream(new ByteArrayInputStream(data)); String loaderName = (String) jis.getManifest().getMainAttributes().getValue("Extension-Loader"); ExtensionLoader loader = (ExtensionLoader) classLoader.loadClass(loaderName).newInstance(); commandManager.resetNewCommands(); loader.load(commandManager); return commandManager.getNewCommands(); }