1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-04-18 07:11:12 +02:00
HD Moore fa51ea5d15 Swapping in the latest patched copy of Meterpreter. See
git-svn-id: file:///home/svn/framework3/trunk@6357 4d416f70-5f16-0410-b530-b9f4589650da
2009-03-22 18:56:28 +00:00

54 lines
1.3 KiB
C

#include "precomp.h"
extern DWORD request_net_tcp_client_channel_open(Remote *remote, Packet *packet);
// Channel type dispatch table
struct
{
LPCSTR type;
DWORD (*handler)(Remote *, Packet *);
} channel_open_handlers[] =
{
{ "stdapi_fs_file", request_fs_file_channel_open },
{ "stdapi_net_tcp_client", request_net_tcp_client_channel_open },
{ NULL, NULL },
};
/*
* Dispatches channel open requests to the appropriate handlers internally if
* they are destined to a type that is managed by this extension.
*/
DWORD request_general_channel_open(Remote *remote, Packet *packet)
{
Packet *response = NULL;
LPCSTR channelType;
DWORD result = ERROR_NOT_FOUND;
DWORD index;
do
{
// Get the requested channel type
channelType = packet_get_tlv_value_string(packet,
TLV_TYPE_CHANNEL_TYPE);
// No channel? Lame.
if (!channelType)
break;
// Enumerate the channel type dispatch table searching for a match
for (index = 0;
channel_open_handlers[index].type;
index++)
{
if (!strcmp(channel_open_handlers[index].type, channelType))
{
result = channel_open_handlers[index].handler(remote, packet);
break;
}
}
} while (0);
return result;
}