feat: Add custom pass support for Ryujin users via callback

- Ryujin users can now register their own callbacks following the standard interface to create custom passes and extend Ryujin’s behavior.
- Updated configuration files to support safe usage.
- Adjusted README.md.
This commit is contained in:
keowu
2025-07-27 09:12:11 -03:00
parent ffe6cb9655
commit 64cdfe6e71
7 changed files with 82 additions and 4 deletions

View File

@@ -2,15 +2,26 @@
#include <vector>
#include <Windows.h>
#include <string>
#include <Zydis/Zydis.h>
#include <Zydis/SharedTypes.h>
#include "../RyujinCore/Ryujin/Models/RyujinProcedure.hh"
#define MAX_PROCEDURES 128
#define MAX_PROCEDURE_NAME_LEN 128
#define MAX_CALLBACKS 10
struct RyujinObfuscatorProcs {
int procedureCount;
char procedures[MAX_PROCEDURES][MAX_PROCEDURE_NAME_LEN];
};
using RyujinCallback = void (*)(RyujinProcedure*);
struct RyujinCallbacks {
int callbackCount;
RyujinCallback callbacks[MAX_CALLBACKS]; // Array de ponteiros de fun<75><6E>o
};
class RyujinObfuscatorConfig {
public:
@@ -25,6 +36,7 @@ public:
bool m_isAntiDump; // Enable Anti Dump technic for Ryujin protected binary
bool m_isMemoryProtection; // Memory CRC32 protection
RyujinObfuscatorProcs m_strProceduresToObfuscate; // Names of the procedures to obfuscate
RyujinCallbacks m_callbacks; // Ryujin Custom Pass Callbacks
static bool RunRyujin(const std::string& strInputFilePath, const std::string& strPdbFilePath, const std::string& strOutputFilePath, RyujinObfuscatorConfig& config) {
@@ -41,4 +53,19 @@ public:
return RunRyujinCore(strInputFilePath.c_str(), strPdbFilePath.c_str(), strOutputFilePath.c_str(), config);
}
RyujinObfuscatorConfig() : m_callbacks{ 0 } {}
bool RegisterCallback(RyujinCallback callback) {
if (m_callbacks.callbackCount < MAX_CALLBACKS) {
m_callbacks.callbacks[m_callbacks.callbackCount] = callback;
m_callbacks.callbackCount++;
return true;
}
return false;
}
};