1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-18 15:14:10 +01:00

Skip command IDs that can't be resolved

The channel_open functions are registered in the same ways as functions,
yet are not typical commands so they need to be skipped.
This commit is contained in:
Spencer McIntyre 2021-02-11 19:29:16 -05:00
parent badaaa4df2
commit 826b13e184

@ -397,7 +397,7 @@ def cmd_string_to_id(this_string):
for that_id, that_string in COMMAND_IDS:
if this_string == that_string:
return that_id
debug_print('[*] failed to lookup string for command string: ' + this_string)
debug_print('[*] failed to lookup id for command string: ' + this_string)
return None
@export
@ -1352,6 +1352,8 @@ class PythonMeterpreter(object):
id_end = packet_get_tlv(request, TLV_TYPE_LENGTH)['value'] + id_start
for func_name in self.extension_functions.keys():
command_id = cmd_string_to_id(func_name)
if command_id is None:
continue
if id_start < command_id and command_id < id_end:
response += tlv_pack(TLV_TYPE_UINT, command_id)
return ERROR_SUCCESS, response