1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-03-24 18:16:24 +01:00
OJ d781fde35c Bring POSIX stuff up to date with correct commands
Fix issue where the correct macros weren't being used for
command declarations.
2013-11-20 09:32:58 +10:00

71 lines
1.6 KiB
C

#include "metcli.h"
/*
* Extension callback for printing out notifications for channels opening
*/
DWORD ex_remote_response_core_channel_open(Remote *remote, Packet *packet)
{
DWORD channelId = packet_get_tlv_value_uint(packet, TLV_TYPE_CHANNEL_ID);
if (channelId)
{
console_write_output(
"\n"
INBOUND_PREFIX " CHANNEL: New remote channel allocated: %lu.\n",
channelId);
console_write_prompt();
}
return ERROR_SUCCESS;
}
/*
* Extension callback for printing out notifications for when the remote
* endpoint is telling us to close a channel
*/
DWORD ex_remote_request_core_channel_close(Remote *remote, Packet *packet)
{
DWORD channelId = packet_get_tlv_value_uint(packet, TLV_TYPE_CHANNEL_ID);
if (channelId)
{
// If an interactive channel is closing, reset it
if (channelId == console_get_interactive_channel_id())
console_set_interactive_channel(remote, NULL);
}
return ERROR_SUCCESS;
}
/****************************
* Custom dispatch routines *
****************************/
// Dispatch table
Command customCommands[] =
{
COMMAND_REP("core_channel_open", ex_remote_response_core_channel_open),
COMMAND_REP("core_channel_close", ex_remote_response_core_channel_cloase),
COMMAND_TERMINATOR
};
/*
* Registers custom command handlers
*/
VOID remote_register_core_dispatch_routines()
{
command_register_all(customCommands);
}
/*
* Deregisters previously registered custom commands
*/
VOID remote_deregister_core_dispatch_routines()
{
command_deregister_all(customCommands);
}