From 65041c3e3ba6838065fbc30c719a916b10d447ab Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:35:02 -0500 Subject: [PATCH] Integrate deobfuscation into remap process --- ReCodeItCLI/ReCodeItCLI.csproj | 6 +++-- RecodeItLib/Remapper/ReCodeItRemapper.cs | 28 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ReCodeItCLI/ReCodeItCLI.csproj b/ReCodeItCLI/ReCodeItCLI.csproj index 311345e..6fd71bd 100644 --- a/ReCodeItCLI/ReCodeItCLI.csproj +++ b/ReCodeItCLI/ReCodeItCLI.csproj @@ -26,6 +26,10 @@ + + + + @@ -36,8 +40,6 @@ - - t.Name.Contains("GClass"))) { - Logger.Log("You must de-obfuscate the assembly before remapping it.\n", ConsoleColor.Red); - return; + Logger.Log("Assembly is obfuscated, running de-obfuscation...\n", ConsoleColor.Yellow); + + Module.Dispose(); + Module = null; + + Deobfuscator.Deobfuscate(assemblyPath); + + var cleanedName = Path.GetFileNameWithoutExtension(assemblyPath); + cleanedName = $"{cleanedName}-cleaned.dll"; + + var newPath = Path.GetDirectoryName(assemblyPath); + newPath = Path.Combine(newPath, cleanedName); + + Console.WriteLine($"Cleaning assembly: {newPath}"); + + Module = DataProvider.LoadModule(newPath); + types = Module.GetTypes(); + + GenerateDynamicRemaps(newPath, types); + } + else + { + GenerateDynamicRemaps(assemblyPath, types); } - - GenerateDynamicRemaps(assemblyPath, types); var tasks = new List(remapModels.Count); foreach (var remap in remapModels)