Hermes/Dyforge is a program written in c++ allows you to inject a dll that can analyze all processes in a program, can be used for mod and reverse engeneering
| 1 | #pragma once |
| 2 | |
| 3 | #include <windows.h> |
| 4 | #include <string> |
| 5 | #include <vector> |
| 6 | #include <memory> |
| 7 | #include <functional> |
| 8 | |
| 9 | // Export macro |
| 10 | #ifdef DyMain_EXPORTS |
| 11 | #define DyMain_API __declspec(dllexport) |
| 12 | #else |
| 13 | #define DyMain_API __declspec(dllimport) |
| 14 | #endif |
| 15 | |
| 16 | // Version info |
| 17 | #define DyMain_VERSION_MAJOR 1 |
| 18 | #define DyMain_VERSION_MINOR 0 |
| 19 | |
| 20 | // Memory layout |
| 21 | struct SharedMemoryLayout { |
| 22 | static const size_t HEADER_SIZE = 128; |
| 23 | static const size_t COMMAND_BUFFER_SIZE = 4096; |
| 24 | static const size_t STATE_BUFFER_SIZE = 8192; |
| 25 | static const size_t TOTAL_SIZE = HEADER_SIZE + COMMAND_BUFFER_SIZE + STATE_BUFFER_SIZE; |
| 26 | }; |
| 27 | |
| 28 | // Function declarations |
| 29 | extern "C" { |
| 30 | bool Initialize(); |
| 31 | void Cleanup(); |
| 32 | bool WriteCommand(const char* command, size_t length); |
| 33 | bool ReadState(char* buffer, size_t bufferSize, size_t* bytesRead); |
| 34 | } |
| 35 | |
| 36 | // Internal functions |
| 37 | namespace DyMain { |
| 38 | // Core System |
| 39 | bool StartDyMain(HMODULE hModule); |
| 40 | void StopDyMain(); |
| 41 | |
| 42 | // Injection Manager |
| 43 | namespace Injection { |
| 44 | bool InitializeInjection(HMODULE hModule); |
| 45 | void ProtectSelf(); |
| 46 | void GetTargetProcessInfo(); |
| 47 | } |
| 48 | |
| 49 | // Memory Manager |
| 50 | namespace Memory { |
| 51 | bool ReadMemory(uintptr_t address, void* buffer, size_t size); |
| 52 | bool WriteMemory(uintptr_t address, const void* buffer, size_t size); |
| 53 | void* AllocateMemory(size_t size); |
| 54 | void FreeMemory(void* address); |
| 55 | bool AnalyzeMemoryRegions(const std::string& pattern, std::vector<uintptr_t>& matches); |
| 56 | } |
| 57 | |
| 58 | // Hook Manager |
| 59 | namespace Hook { |
| 60 | bool CreateInlineHook(void* target, void* detour, void** original); |
| 61 | bool RemoveHook(void* target); |
| 62 | void ListActiveHooks(); |
| 63 | } |
| 64 | |
| 65 | // Mod Manager |
| 66 | namespace Mod { |
| 67 | bool LoadMod(const std::string& modPath); |
| 68 | bool UnloadMod(const std::string& modName); |
| 69 | void ListMods(); |
| 70 | bool GetDependencies(const std::string& modPath, std::vector<std::string>& dependencies); |
| 71 | } |
| 72 | |
| 73 | // Deep Analyzer |
| 74 | namespace Analyzer { |
| 75 | void ListThreads(); |
| 76 | void DumpModules(); |
| 77 | void AnalyzeMemoryRegions(); |
| 78 | void DetectAntiCheatMechanisms(); |
| 79 | } |
| 80 | |
| 81 | // Web Server Integration |
| 82 | namespace WebServer { |
| 83 | bool StartWebServer(int port = 8080); |
| 84 | void StopWebServer(); |
| 85 | void BroadcastEvent(const std::string& event); |
| 86 | } |
| 87 | |
| 88 | // Utility Helpers |
| 89 | namespace Utils { |
| 90 | bool PatternToByteArray(const std::string& pattern, std::vector<int>& bytes); |
| 91 | bool CompareMemoryPattern(const uint8_t* data, const std::vector<int>& pattern); |
| 92 | bool ScanMemoryForPatterns(const std::string& pattern, std::vector<uintptr_t>& matches); |
| 93 | void HexDump(const void* ptr, size_t size); |
| 94 | |
| 95 | namespace Logger { |
| 96 | void LogInfo(const std::string& msg); |
| 97 | void LogWarning(const std::string& msg); |
| 98 | void LogError(const std::string& msg); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Strutture di base |
| 103 | struct Command { |
| 104 | enum class Type { |
| 105 | START_ANALYSIS, |
| 106 | STOP_ANALYSIS, |
| 107 | LOAD_MOD, |
| 108 | UNLOAD_MOD, |
| 109 | INSTALL_HOOK, |
| 110 | REMOVE_HOOK, |
| 111 | SCAN_MEMORY, |
| 112 | WRITE_MEMORY |
| 113 | }; |
| 114 | |
| 115 | Type type; |
| 116 | std::vector<uint8_t> data; |
| 117 | }; |
| 118 | |
| 119 | struct State { |
| 120 | bool isAnalysisRunning; |
| 121 | uint32_t activeHooks; |
| 122 | uint32_t loadedMods; |
| 123 | }; |
| 124 | |
| 125 | struct MemoryConfig { |
| 126 | uintptr_t startAddress; |
| 127 | size_t size; |
| 128 | std::string pattern; |
| 129 | }; |
| 130 | |
| 131 | struct MemoryWrite { |
| 132 | uintptr_t address; |
| 133 | std::vector<uint8_t> data; |
| 134 | }; |
| 135 | |
| 136 | struct MemoryInfo { |
| 137 | std::vector<uintptr_t> matches; |
| 138 | size_t totalScanned; |
| 139 | }; |
| 140 | |
| 141 | struct HookConfig { |
| 142 | void* target; |
| 143 | void* detour; |
| 144 | std::string name; |
| 145 | }; |
| 146 | |
| 147 | struct ModConfig { |
| 148 | std::string path; |
| 149 | std::string name; |
| 150 | std::vector<std::string> dependencies; |
| 151 | }; |
| 152 | |
| 153 | struct AnalysisConfig { |
| 154 | bool scanMemory; |
| 155 | bool scanThreads; |
| 156 | bool scanModules; |
| 157 | bool detectAntiCheat; |
| 158 | }; |
| 159 | |
| 160 | struct ProcessInfo { |
| 161 | DWORD processId; |
| 162 | std::wstring name; |
| 163 | std::wstring path; |
| 164 | bool is64Bit; |
| 165 | }; |
| 166 | |
| 167 | struct ModuleInfo { |
| 168 | HMODULE handle; |
| 169 | std::wstring name; |
| 170 | std::wstring path; |
| 171 | uintptr_t baseAddress; |
| 172 | size_t size; |
| 173 | }; |
| 174 | |
| 175 | struct ThreadInfo { |
| 176 | DWORD threadId; |
| 177 | DWORD basePriority; |
| 178 | void* startAddress; |
| 179 | bool isSuspended; |
| 180 | }; |
| 181 | |
| 182 | struct WebServerConfig { |
| 183 | uint16_t port; |
| 184 | bool enableWebSocket; |
| 185 | bool enableSSL; |
| 186 | std::string certPath; |
| 187 | std::string keyPath; |
| 188 | }; |
| 189 | |
| 190 | // Funzioni principali |
| 191 | bool StartDyMain(HMODULE hModule); |
| 192 | void StopDyMain(); |
| 193 | |
| 194 | } // namespace DyMain |
| 195 | |
| 196 | // Funzioni esportate |
| 197 | extern "C" { |
| 198 | DyMain_API bool WriteCommandEx(const DyMain::Command* cmd); |
| 199 | DyMain_API bool ReadStateEx(DyMain::State* state); |
| 200 | DyMain_API bool InjectDLL(const wchar_t* dllPath); |
| 201 | DyMain_API bool EjectDLL(DWORD processId); |
| 202 | DyMain_API bool ScanMemory(const DyMain::MemoryConfig* config, DyMain::MemoryInfo* info); |
| 203 | DyMain_API bool WriteMemory(const DyMain::MemoryWrite* write); |
| 204 | DyMain_API bool InstallHook(const DyMain::HookConfig* config); |
| 205 | DyMain_API bool RemoveHook(const DyMain::HookConfig* config); |
| 206 | DyMain_API bool LoadMod(const DyMain::ModConfig* config); |
| 207 | DyMain_API bool UnloadMod(const DyMain::ModConfig* config); |
| 208 | DyMain_API bool StartAnalysis(const DyMain::AnalysisConfig* config); |
| 209 | DyMain_API bool StopAnalysis(); |
| 210 | DyMain_API bool StartWebServer(const DyMain::WebServerConfig* config); |
| 211 | DyMain_API bool StopWebServer(); |
| 212 | DyMain_API bool GetProcessInfo(DyMain::ProcessInfo* info); |
| 213 | DyMain_API bool GetModuleInfo(DyMain::ModuleInfo* info); |
| 214 | DyMain_API bool GetThreadInfo(DyMain::ThreadInfo* info); |
| 215 | } |