由于需要查看通信过程中的明文协议,但是抓包发现有点问题,在OD下跟了下,发现使用了微软的CryptSignAndEncryptMessage对数据包进行了加密,并没有其他附加处理,那么索性使用Detours拦截这个函数,然后将相关协议数据写入文件。
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#define SECURITY_WIN32
#include <sspi.h>
#pragma comment(lib, "Secur32.lib")
#include "detours.h"
#pragma comment(lib, "detours.lib")
#pragma comment(lib, "detoured.lib")
#ifdef _MANAGED
#pragma managed(push, off)
#endif
extern "C" _declspec(dllexport) VOID NullExport();
VOID NullExport()
{
}
/*
typedef LONG SECURITY_STATUS;
typedef struct _SecHandle
{
ULONG_PTR dwLower;
ULONG_PTR dwUpper;
} SecHandle, * PSecHandle ;
typedef PSecHandle PCtxtHandle;
typedef struct _SecBuffer
{
unsigned long cbBuffer;
unsigned long BufferType;
void* pvBuffer;
} SecBuffer, * PSecBuffer;
typedef