-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
54 lines (47 loc) · 1.51 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <winsock2.h>
#include <Windows.h>
#include "wiz_msgs.h"
#include "wiz_packet.h"
#include "MinHook.h"
#include "sigs.h"
int main()
{
const auto protocols = get_protocols();
for (auto bypass_address : get_vf_references()) {
DWORD old;
VirtualProtect(reinterpret_cast<LPVOID>(bypass_address), 4, PAGE_READWRITE, &old);
*reinterpret_cast<uintptr_t*>(bypass_address) = reinterpret_cast<uint32_t>(&ogProcessData_hook);
VirtualProtect(reinterpret_cast<LPVOID>(bypass_address), 4, old, &old);
}
MH_Initialize();
const auto wsock32 = GetModuleHandle(L"wsock32.dll");
if (wsock32) {
const LPVOID recv_address = GetProcAddress(wsock32, "recv");
MH_CreateHook(recv_address, &recv_hook, reinterpret_cast<LPVOID*>(&o_recv));
MH_EnableHook(recv_address);
}
const auto w2sock32 = GetModuleHandle(L"Ws2_32.dll");
if (w2sock32) {
const LPVOID wsasend_address = GetProcAddress(w2sock32, "WSASend");
MH_CreateHook(wsasend_address, &wsasend_hook, reinterpret_cast<LPVOID*>(&o_wsasend));
MH_EnableHook(wsasend_address);
}
}
BOOL WINAPI DllMain(HMODULE dll, DWORD reason, PVOID reserved) {
DisableThreadLibraryCalls(static_cast<HMODULE>(dll));
switch (reason)
{
case DLL_PROCESS_ATTACH: {
AllocConsole();
freopen("CONOUT$", "w", stdout);
freopen("CONIN$", "r", stdin);
CreateThread(nullptr, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(main), nullptr, NULL, nullptr);
break;
}
case DLL_PROCESS_DETACH:
break;
default:
break;
}
return TRUE;
}