feat: Improved pointer safety and performance for better adaptability. Also updated the README.

- Improved and organized pointer safety.
- Removed old, unused fields from the config.
- Introduced RyuJinConfigInternal to separate internal fields not directly related to the exposed config, used only by the Ryujin core.
- Updated README.md.
This commit is contained in:
keowu
2025-07-26 22:16:21 -03:00
parent 487f061d6c
commit ffe6cb9655
7 changed files with 22 additions and 21 deletions

View File

@@ -20,7 +20,7 @@
- Anti-Dump
- Anti-Disassembly + Anti-Decompiler
- Memory Protection(CRC32)
- Custom Passes(Planned - **TODO**)
- Custom Passes(**TODO**)
---

View File

@@ -25,7 +25,6 @@ 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
std::vector<std::string> m_strdProceduresToObfuscate; // Names of the procedures to obfuscate
static bool RunRyujin(const std::string& strInputFilePath, const std::string& strPdbFilePath, const std::string& strOutputFilePath, RyujinObfuscatorConfig& config) {

View File

@@ -9,6 +9,13 @@ struct RyujinObfuscatorProcs {
char procedures[MAX_PROCEDURES][MAX_PROCEDURE_NAME_LEN];
};
class RyuJinConfigInternal {
public:
std::vector<std::string> m_strdProceduresToObfuscate; // Names of the procedures to obfuscate
};
class RyujinObfuscatorConfig {
public:
@@ -22,8 +29,7 @@ public:
bool m_isTrollRerversers; // The user wants to trick and use a special feature to troll reversers when their debugs be detected making they loose all the progress
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 - FFI
std::vector<std::string> m_strdProceduresToObfuscate; // Names of the procedures to obfuscate
RyujinObfuscatorProcs m_strProceduresToObfuscate; // Names of the procedures to obfuscate
// todo: passes
};

View File

@@ -44,7 +44,7 @@ Ryujin::Ryujin(const std::string& strInputFilePath, const std::string& strPdbFil
}
bool Ryujin::run(const RyujinObfuscatorConfig& config) {
bool Ryujin::run(const RyujinObfuscatorConfig& config, const std::shared_ptr<RyuJinConfigInternal>& ryujConfigInternal) {
auto imgDos = reinterpret_cast<PIMAGE_DOS_HEADER>(m_mappedPE.get());
@@ -83,7 +83,7 @@ bool Ryujin::run(const RyujinObfuscatorConfig& config) {
return FALSE;
}
if (config.m_strdProceduresToObfuscate.size() == 0) {
if (ryujConfigInternal->m_strdProceduresToObfuscate.size() == 0) {
::OutputDebugStringA(
@@ -98,9 +98,9 @@ bool Ryujin::run(const RyujinObfuscatorConfig& config) {
std::vector<RyujinObfuscationCore> processed_procs;
for (auto& proc : m_ryujinProcedures) {
auto it = std::find(config.m_strdProceduresToObfuscate.begin(), config.m_strdProceduresToObfuscate.end(), proc.name);
auto it = std::find(ryujConfigInternal->m_strdProceduresToObfuscate.begin(), ryujConfigInternal->m_strdProceduresToObfuscate.end(), proc.name);
if (it == config.m_strdProceduresToObfuscate.end()) continue;
if (it == ryujConfigInternal->m_strdProceduresToObfuscate.end()) continue;
std::printf(

View File

@@ -26,7 +26,7 @@ private:
public:
Ryujin(const std::string& strInputFilePath, const std::string& strPdbFilePath, const std::string& strOutputFilePath);
bool run(const RyujinObfuscatorConfig& config);
bool run(const RyujinObfuscatorConfig& config, const std::shared_ptr<RyuJinConfigInternal>& ryujConfigInternal);
void listRyujinProcedures();
~Ryujin() { }

View File

@@ -8,24 +8,21 @@ RYUJINCORE_API BOOL __stdcall RunRyujinCore(const char* strInputFilePath, const
if (!strInputFilePath || !strPdbFilePath || !strOutputFilePath) return FALSE;
if (config.m_strdProceduresToObfuscate.empty()) {
std::vector<std::string> strProcsProcessed;
std::vector<std::string> strProcsProcessed;
strProcsProcessed.reserve(config.m_strProceduresToObfuscate.procedureCount);
strProcsProcessed.reserve(config.m_strProceduresToObfuscate.procedureCount);
for (int i = 0; i < config.m_strProceduresToObfuscate.procedureCount; ++i)
strProcsProcessed.emplace_back(config.m_strProceduresToObfuscate.procedures[i]);
for (int i = 0; i < config.m_strProceduresToObfuscate.procedureCount; ++i)
strProcsProcessed.emplace_back(config.m_strProceduresToObfuscate.procedures[i]);
config.m_strdProceduresToObfuscate.assign(strProcsProcessed.begin(), strProcsProcessed.end());
}
std::shared_ptr<RyuJinConfigInternal> ryujConfigInternal = std::make_shared<RyuJinConfigInternal>();
ryujConfigInternal->m_strdProceduresToObfuscate.assign(strProcsProcessed.begin(), strProcsProcessed.end());
std::unique_ptr<Ryujin> ryujin = std::make_unique<Ryujin>(strInputFilePath, strPdbFilePath, strOutputFilePath);
ryujin.get()->listRyujinProcedures();
ryujin.get()->run(config);
ryujin.get()->run(config, ryujConfigInternal);
ryujin.reset();

View File

@@ -24,8 +24,7 @@ public:
bool m_isTrollRerversers; // The user wants to trick and use a special feature to troll reversers when their debugs be detected making they loose all the progress
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 - FFI
std::vector<std::string> m_strdProceduresToObfuscate; // Names of the procedures to obfuscate
RyujinObfuscatorProcs m_strProceduresToObfuscate; // Names of the procedures to obfuscate
static bool RunRyujin(const std::string& strInputFilePath, const std::string& strPdbFilePath, const std::string& strOutputFilePath, RyujinObfuscatorConfig& config) {