Add a meterpreter test for enumerating core commands

This commit is contained in:
Spencer McIntyre 2021-01-14 12:13:16 -05:00 committed by Grant Willcox
parent 998b38cf0d
commit 7cf5879836
No known key found for this signature in database
GPG Key ID: D35E05C0F2B81E83
2 changed files with 14 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class ClientCore < Extension
def get_loaded_extension_commands(extension)
request = Packet.create_request(COMMAND_ID_CORE_ENUMEXTCMD)
# handle 'core' as a special case since it's not a typical extension
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)

View File

@ -47,6 +47,19 @@ class MetasploitModule < Msf::Post
super
end
def test_core_command_id_enumeration
commands = []
it "should enumerate supported core commands" do
commands.concat(session.core.get_loaded_extension_commands('core'))
!commands.empty?
end
# 3 is arbitrary, but it's probably a good bare minimum to include enumextcmd, machine_id, and loadlib
it "should support 3 or more core commands" do
commands.length >= 3
end
end
def test_sys_process
vprint_status("Starting process tests")