0
0
mirror of https://github.com/sp-tarkov/assembly-tool.git synced 2025-02-12 17:10:45 -05:00

Integrate deobfuscation into remap process

This commit is contained in:
Cj 2024-12-30 23:35:02 -05:00
parent 4e33f48be0
commit 65041c3e3b
2 changed files with 28 additions and 6 deletions

View File

@ -26,6 +26,10 @@
<Output TaskParameter="OutputItems" ItemName="OutputPath" />
</Target>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<RemoveDir Directories="$(SolutionDir)Build\**\*.*" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<ItemGroup>
<de4dot Include="$(SolutionDir)de4dot\$(Configuration)\net48\*.*" />
@ -36,8 +40,6 @@
<MSBuild Projects="$(AssemblyServerProj)" Properties="Configuration=$(Configuration)" />
<MSBuild Projects="$(de4dot-x64Proj)" Properties="Configuration=$(Configuration)" />
<RemoveDir Directories="$(SolutionDir)Build" />
<Copy
SourceFiles="@(Cli)"
DestinationFolder="$(SolutionDir)Build\%(RecursiveDir)"

View File

@ -7,6 +7,7 @@ using ReCodeIt.Utils;
using ReCodeItLib.Remapper.Search;
using System.Diagnostics;
using System.Reflection;
using ReCodeItLib.Remapper;
namespace ReCodeIt.ReMapper;
@ -59,11 +60,30 @@ public class ReCodeItRemapper
if (!types.Any(t => 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<Task>(remapModels.Count);
foreach (var remap in remapModels)