1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-08-22 13:47:14 +02:00
Files
metasploit-payloads/c/meterpreter/source/metsrv/packet_encryption.h
OJ 4ffe127f04 Begin removing the delay-load dependency
The 'common' library has been removed. The only project that actually
used it was metsrv, so the code that metsrv required from common is now
directly compiled in as part of that project.

The common folder now contains files that are importanta cross all of
the projects, with a primary focus on the new "API" style function. What
this means is that MetSrv has an API that it exposes through a function
pointer that is passed to the extension when it's initialised. This
pointer references a structure with all the API functions wired in. This
means that:

* Extensions don't need to know anything about metsrv at compile time.
* The delay loading code can be removed, which was one of the last
  instances of "metsrv.dll" as a string.
* Metsrv.dll no longer exports any functions.

More to come.
2020-04-22 13:06:40 +10:00

37 lines
841 B
C

#ifndef _METERPRETER_METSRV_PACKET_ENCRYPTION_H
#define _METERPRETER_METSRV_PACKET_ENCRYPTION_H
#include <Windows.h>
#define AES256_BLOCKSIZE 16
#define ENC_FLAG_NONE 0x0
#define ENC_FLAG_AES256 0x1
typedef struct _Aes256Key
{
BLOBHEADER header;
DWORD length;
BYTE key[256/8];
} Aes256Key;
typedef struct _PacketEncryptionContext
{
HCRYPTPROV provider;
HCRYPTKEY aes_key;
int provider_idx;
BOOL valid;
Aes256Key key_data;
BOOL enabled;
} PacketEncryptionContext;
typedef struct _Remote Remote;
typedef struct _Packet Packet;
DWORD decrypt_packet(Remote* remote, Packet** packet, LPBYTE buffer, DWORD bufferSize);
DWORD encrypt_packet(Remote* remote, Packet* packet, LPBYTE* buffer, LPDWORD bufferSize);
DWORD request_negotiate_aes_key(Remote* remote, Packet* packet);
DWORD free_encryption_context(Remote* remote);
#endif