66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
#include <windows.h>
|
|
|
|
#include "taikohook/network.h"
|
|
|
|
#include "hook/table.h"
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
void network_insert_hooks(HMODULE target);
|
|
|
|
static uint64_t my_TLSv1_method();
|
|
static uint64_t my_SSL_CTX_new(void *method);
|
|
static uint64_t (*next_TLSv1_2_method)();
|
|
static uint64_t (*next_TLSv1_method)();
|
|
static uint64_t (*next_SSL_CTX_new)(void *method);
|
|
|
|
static const struct hook_symbol nethook_syms[] = {
|
|
{
|
|
.link = (void *) &next_TLSv1_2_method,
|
|
.ordinal = 350
|
|
},
|
|
{
|
|
.patch = my_TLSv1_method,
|
|
.link = (void *) &next_TLSv1_method,
|
|
.ordinal = 170
|
|
},
|
|
{
|
|
.patch = my_SSL_CTX_new,
|
|
.link = (void *) &next_SSL_CTX_new,
|
|
.ordinal = 12
|
|
},
|
|
};
|
|
|
|
HRESULT network_hook_init(const struct ferrum_network_config *cfg)
|
|
{
|
|
if (!cfg->enable) {
|
|
return S_FALSE;
|
|
}
|
|
|
|
dprintf("Nethook: Init\n");
|
|
network_insert_hooks(NULL);
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
void network_insert_hooks(HMODULE target)
|
|
{
|
|
hook_table_apply(
|
|
target,
|
|
"ssleay32.dll",
|
|
nethook_syms,
|
|
_countof(nethook_syms)
|
|
);
|
|
}
|
|
|
|
static uint64_t my_TLSv1_method()
|
|
{
|
|
dprintf("Nethook: Redirect TLS v1.0 to v1.2\n");
|
|
return next_TLSv1_2_method();
|
|
}
|
|
|
|
static uint64_t my_SSL_CTX_new(void *method)
|
|
{
|
|
dprintf("Nethook: my_SSL_CTX_new\n");
|
|
return next_SSL_CTX_new(method);
|
|
} |