Enumerate Meterpreter's supported core commands
This commit is contained in:
parent
ae7e8c44b5
commit
998b38cf0d
|
@ -151,6 +151,8 @@ class Meterpreter < Rex::Post::Meterpreter::Client
|
|||
# TODO: This session was either staged or previously known, and so we should do some accounting here!
|
||||
end
|
||||
|
||||
session.commands.concat(session.core.get_loaded_extension_commands('core'))
|
||||
|
||||
# Unhook the process prior to loading stdapi to reduce logging/inspection by any AV/PSP
|
||||
if datastore['AutoUnhookProcess'] == true
|
||||
console.run_single('load unhook')
|
||||
|
|
|
@ -316,7 +316,6 @@ class Client
|
|||
# registered extension that can be reached through client.ext.[extension].
|
||||
#
|
||||
def add_extension(name, commands=[])
|
||||
self.commands |= []
|
||||
self.commands.concat(commands)
|
||||
|
||||
# Check to see if this extension has already been loaded.
|
||||
|
|
|
@ -98,11 +98,15 @@ class ClientCore < Extension
|
|||
#
|
||||
# Get a list of loaded commands for the given extension.
|
||||
#
|
||||
def get_loaded_extension_commands(extension_name)
|
||||
# @param [String, Integer] extension Either the extension name or the extension ID to load the commands for.
|
||||
#
|
||||
# @return [Array<Integer>] An array of command IDs that are supported by the specified extension.
|
||||
def get_loaded_extension_commands(extension)
|
||||
request = Packet.create_request(COMMAND_ID_CORE_ENUMEXTCMD)
|
||||
|
||||
start = Rex::Post::Meterpreter::ExtensionMapper.get_extension_id(extension_name)
|
||||
request.add_tlv(TLV_TYPE_UINT, start)
|
||||
extension = EXTENSION_ID_CORE if extension == 'core'
|
||||
extension = Rex::Post::Meterpreter::ExtensionMapper.get_extension_id(extension) unless extension.is_a? Integer
|
||||
request.add_tlv(TLV_TYPE_UINT, extension)
|
||||
request.add_tlv(TLV_TYPE_LENGTH, COMMAND_ID_RANGE)
|
||||
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue