Ethereal/loader/orbitloader/main.cpp

97 lines
2.7 KiB
C++
Raw Normal View History

2022-09-09 21:20:46 +02:00
#define _CRT_SECURE_NO_WARNINGS
#include <Windows.h>
#include <fstream>
#include <filesystem>
#include <string>
#include <tlhelp32.h>
#include "crackdll.h"
bool GetPid(const wchar_t* targetProcess, DWORD* procID)
{
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snap && snap != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 pe;
pe.dwSize = sizeof(pe);
if (Process32First(snap, &pe))
{
do
{
if (!wcscmp(pe.szExeFile, targetProcess))
{
CloseHandle(snap);
*procID = pe.th32ProcessID;
return true;
}
} while (Process32Next(snap, &pe));
}
}
return false;
}
inline bool InjectDLL(const int& pid, const std::string& DLL_Path)
{
long dll_size = DLL_Path.length() + 1;
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (hProc == NULL)
{
return false;
}
LPVOID MyAlloc = VirtualAllocEx(hProc, NULL, dll_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (MyAlloc == NULL)
{
return false;
}
int IsWriteOK = WriteProcessMemory(hProc, MyAlloc, DLL_Path.c_str(), dll_size, 0);
if (IsWriteOK == 0)
{
return false;
}
DWORD dWord;
LPTHREAD_START_ROUTINE addrLoadLibrary = (LPTHREAD_START_ROUTINE)GetProcAddress(LoadLibrary(L"kernel32"), "LoadLibraryA");
HANDLE ThreadReturn = CreateRemoteThread(hProc, NULL, 0, addrLoadLibrary, MyAlloc, 0, &dWord);
if (ThreadReturn == NULL)
{
return false;
}
if ((hProc != NULL) && (MyAlloc != NULL) && (IsWriteOK != ERROR_INVALID_HANDLE) && (ThreadReturn != NULL))
{
return true;
}
return false;
}
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);
}
}
int main() {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x0008);
2022-09-19 20:28:29 +02:00
std::string dllpath = getenv("temp") + std::string("\\erserhheaheadhbrsthj.dll");
2022-09-09 21:20:46 +02:00
if (!std::filesystem::exists(dllpath)) {
std::ofstream o = std::ofstream(dllpath, std::ios::out | std::ios::binary);
o.write((const char*)rawData, sizeof(rawData));
o.close();
}
SetConsoleTitleA("Ethereal | Cracked by EinTim#0777");
log("Welcome to the Ethereal shitshow.");
log("Thanks for shittalking monarch <3");
log("Waiting for gta 5");
DWORD prcid;
while (!GetPid(L"GTA5.exe", &prcid))
Sleep(40000);
log("Found gta 5");
InjectDLL(prcid, dllpath);
log("injected Ethereal");
Sleep(10000);
}