mirror of
https://github.com/rapid7/metasploit-payloads
synced 2024-11-20 14:39:22 +01:00
de05b53dc8
This should help anybody create new Java Meterpreter Extensions and configuring the build system to properly build, test and deploy them. The generated sample extension already contains two simple commands, to serve as a base for more complex commands.
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
To create a new Java Meterpreter extension, you can use a templating system
|
|
called Maven Archetypes.
|
|
|
|
In this directory, type
|
|
|
|
cd extension-archetype
|
|
mvn install
|
|
cd ..
|
|
mvn -DarchetypeGroupId=com.metasploit -DarchetypeArtifactId=extension-archetype -Dversion=1-SNAPSHOT archetype:generate
|
|
|
|
and follow the instructions.
|
|
|
|
You can choose arbitrary groupId, artifactId and package names; the
|
|
default extensions use
|
|
groupId: com.metasploit
|
|
artifactId: Metasploit-Java-Meterpreter-${pluginName}
|
|
package: com.metasploit.meterpreter.${pluginName}
|
|
|
|
The pluginName must satisfy the constraints for a Meterpreter plugin name:
|
|
only lowercase letters and digits are allowed, and the first character may
|
|
not be a digit.
|
|
|
|
|
|
The newly created project will include a <NAME>.rb file in its root directory
|
|
that needs to be moved to
|
|
|
|
msf3/lib/rex/post/meterpreter/extensions/<NAME>/<NAME>.rb
|
|
|
|
so that the extension can be loaded from a post module (or interactively
|
|
from irb) like this:
|
|
|
|
client = session
|
|
if client.<NAME> == nil
|
|
client.core.use('<NAME>')
|
|
end
|
|
print_status client.<NAME>.<NAME>_greet_world()
|