Ethereal/dll/HEH/dllmain.cpp

78 lines
2.6 KiB
C++
Raw Normal View History

2022-09-09 21:20:46 +02:00
#define _CRT_SECURE_NO_WARNINGS
#include <thread>
#include <filesystem>
#include <fstream>
#include <string>
2022-09-12 17:19:29 +02:00
#include <windows.h>
2022-09-09 21:20:46 +02:00
#include <sstream>
HANDLE p;
void patch(PVOID address, int opCode, int bytes) {
DWORD protectbak, dumbshit;
VirtualProtectEx(p, address, bytes, PAGE_EXECUTE_READWRITE, &protectbak);
memset(address, opCode, bytes);
VirtualProtectEx(p, address, bytes, protectbak, &dumbshit);
}
void patchm(PVOID address, std::vector<char> bytes, int size) {
DWORD protectbak, dumbshit;
VirtualProtect(address, size, PAGE_EXECUTE_READWRITE, &protectbak);
memcpy(address, bytes.data(), size);
VirtualProtect(address, size, protectbak, &dumbshit);
}
void log(const char* msg) {
2022-09-09 21:52:56 +02:00
time_t currentTime;
struct tm* localTime;
time(&currentTime);
localTime = localtime(&currentTime);
printf("[%02d:%02d:%02d] %s\n", localTime->tm_hour, localTime->tm_min, localTime->tm_sec, msg);
2022-09-09 21:20:46 +02:00
}
__declspec(dllexport) void lessgo(HMODULE hmod) {
AllocConsole();
p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
freopen("CONOUT$", "w", stdout);
2022-09-09 21:52:56 +02:00
DWORD64 mod = (DWORD64)LoadLibraryA(std::string("C:\\Ethereal\\Ethereal.dll").c_str());
2022-09-09 21:20:46 +02:00
std::stringstream ss;
ss << std::hex << mod;
2022-09-19 20:28:29 +02:00
patch((void*)(mod + 0x4BFA0), 0xB8, 1);
log("Applied patch 1/12");
patch((void*)(mod + 0x4BFA1), 0x01, 1);
log("Applied patch 2/12");
patch((void*)(mod + 0x4BFA2), 0x00, 1);
log("Applied patch 3/12");
patch((void*)(mod + 0x4BFA3), 0x00, 1);
log("Applied patch 4/12");
patch((void*)(mod + 0x4BFA4), 0x00, 1);
log("Applied patch 5/12");
patch((void*)(mod + 0x4BFA5), 0xC3, 1);
log("Applied patch 6/12");
patch((void*)(mod + 0x4BFA6), 0x90, 1);
log("Applied patch 7/12");
patch((void*)(mod + 0x4BFA7), 0x90, 1);
log("Applied patch 8/12");
patch((void*)(mod + 0x4BFA8), 0x90, 1);
log("Applied patch 9/12");
patch((void*)(mod + 0x4BFA9), 0x90, 1);
log("Applied patch 10/12");
patch((void*)(mod + 0x3FE650), 0x01, 1);
log("Applied patch 10/11");
patch((void*)(mod + 0x3FE653), 0x01, 1);
log("Applied patch 10/12");
2022-09-09 21:20:46 +02:00
while (FindWindowA(0, "Ethereal") == NULL) Sleep(100);
HWND w = FindWindowA(0, "Ethereal");
SetWindowTextA(w, "Ethereal | cracked by EinTim#0777");
}
BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
if(ul_reason_for_call == 1){
CreateThread(nullptr, NULL, [](LPVOID hmod) -> DWORD {
lessgo((HMODULE)hmod);
return 0;
}, NULL, NULL, NULL);
return TRUE;
}
return FALSE;
}