#include #include "taikohook/network.h" #include "hook/table.h" #include "util/dprintf.h" void network_insert_hooks(HMODULE target); static uint64_t my_TLSv1_method(uint64_t a1, uint64_t flag); static uint64_t (*next_TLSv1_2_method)(uint64_t a1, uint64_t flag); static uint64_t (*next_TLSv1_method)(uint64_t a1, uint64_t flag); static const struct hook_symbol nethook_syms[] = { { .link = (void *) &next_TLSv1_2_method, .ordinal = 341 }, { .patch = my_TLSv1_method, .link = (void *) &next_TLSv1_method, .ordinal = 172 }, }; 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(uint64_t a1, uint64_t flag) { dprintf("Nethook: Redirect TLS v1.0 to v1.2\n"); return next_TLSv1_2_method(a1, flag); }