Ethereal/dll/HEH/dllmain.cpp

80 lines
2.8 KiB
C++

#define _CRT_SECURE_NO_WARNINGS
#include "MinHook.h"
#include <thread>
#include <filesystem>
#include <fstream>
#include <string>
#include <sstream>
#include "obfuscate.h"
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);
}
bool neger = true;
void log(const char* msg) {
if (neger) {
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);
}
}
__declspec(dllexport) void lessgo(HMODULE hmod) {
AllocConsole();
p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
freopen("CONOUT$", "w", stdout);
DWORD64 mod = (DWORD64)LoadLibraryA(std::string(AY_OBFUSCATE("C:\\Ethereal\\Ethereal.dll")).c_str());
std::stringstream ss;
ss << std::hex << mod;
patch((void*)(mod + 0x000000000004A980), 0xB8, 1);
log(AY_OBFUSCATE("Applied patch 1/10"));
patch((void*)(mod + 0x000000000004A981), 0x01, 1);
log(AY_OBFUSCATE("Applied patch 2/10"));
patch((void*)(mod + 0x000000000004A982), 0x00, 1);
log(AY_OBFUSCATE("Applied patch 3/10"));
patch((void*)(mod + 0x000000000004A983), 0x00, 1);
log(AY_OBFUSCATE("Applied patch 4/10"));
patch((void*)(mod + 0x000000000004A984), 0x00, 1);
log(AY_OBFUSCATE("Applied patch 5/10"));
patch((void*)(mod + 0x000000000004A985), 0xC3, 1);
log(AY_OBFUSCATE("Applied patch 6/10"));
patch((void*)(mod + 0x000000000004A986), 0x90, 1);
log(AY_OBFUSCATE("Applied patch 7/10"));
patch((void*)(mod + 0x000000000004A987), 0x90, 1);
log(AY_OBFUSCATE("Applied patch 8/10"));
patch((void*)(mod + 0x000000000004A988), 0x90, 1);
log(AY_OBFUSCATE("Applied patch 9/10"));
patch((void*)(mod + 0x000000000004A989), 0x90, 1);
log(AY_OBFUSCATE("Applied patch 10/10"));
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;
}