1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-04-06 01:16:37 +02:00

Merge pull request from bcook-r7/land-5-maven-fixes

update sample module code and provide property defaults
This commit is contained in:
Michael Schierl 2015-01-31 15:48:42 +01:00
commit 42c3b34289
2 changed files with 51 additions and 31 deletions
java/meterpreter/extension-archetype/src/main/resources
META-INF/maven
archetype-resources

@ -5,6 +5,15 @@
name="Java Meterpreter extension archetype"> name="Java Meterpreter extension archetype">
<requiredProperties> <requiredProperties>
<requiredProperty key="pluginName" /> <requiredProperty key="pluginName" />
<requiredProperty key="groupId">
<defaultValue>com.metasploit</defaultValue>
</requiredProperty>
<requiredProperty key="artifactId">
<defaultValue>Metasploit-Java-Meterpreter-${pluginName}</defaultValue>
</requiredProperty>
<requiredProperty key="package">
<defaultValue>com.metasploit.meterpreter.${pluginName}</defaultValue>
</requiredProperty>
</requiredProperties> </requiredProperties>
<fileSets> <fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8"> <fileSet filtered="true" packaged="true" encoding="UTF-8">

@ -1,13 +1,15 @@
# -*- coding: binary -*-
module Rex module Rex
module Post module Post
module Meterpreter module Meterpreter
module Extensions module Extensions
# This module contains a 'Hello World' meterpreter extension
module ${pluginName.substring(0,1).toUpperCase()}${pluginName.substring(1)} module ${pluginName.substring(0,1).toUpperCase()}${pluginName.substring(1)}
TLV_TYPE_GREETEE = TLV_META_TYPE_STRING | (TLV_EXTENSIONS + 1)
TLV_TYPE_GREETEE = TLV_META_TYPE_STRING | (TLV_EXTENSIONS + 1); # This module implements a 'Hello World' meterpreter extension
class ${pluginName.substring(0,1).toUpperCase()}${pluginName.substring(1)} < Extension class ${pluginName.substring(0,1).toUpperCase()}${pluginName.substring(1)} < Extension
def initialize(client) def initialize(client)
super(client, '${pluginName}') super(client, '${pluginName}')
@ -20,18 +22,27 @@ class ${pluginName.substring(0,1).toUpperCase()}${pluginName.substring(1)} < Ext
]) ])
end end
def ${pluginName}_greet_world() # Sends a greet_world request and gets a reply
#
# @return [String]
def ${pluginName}_greet_world
request = Packet.create_request('${pluginName}_greet_world') request = Packet.create_request('${pluginName}_greet_world')
response = client.send_request(request) response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_STRING) response.get_tlv_value(TLV_TYPE_STRING)
end end
# Sends a greet_someone request and gets a reply
#
# @return [String]
def ${pluginName}_greet_someone(greetee) def ${pluginName}_greet_someone(greetee)
request = Packet.create_request('${pluginName}_greet_someone') request = Packet.create_request('${pluginName}_greet_someone')
request.add_tlv(TLV_TYPE_GREETEE, greetee) request.add_tlv(TLV_TYPE_GREETEE, greetee)
response = client.send_request(request) response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_STRING) response.get_tlv_value(TLV_TYPE_STRING)
end
end
end
end
end
end end
end end
end; end; end; end; end