From 411c6897ed665ad67de910575834eebdfb6914a1 Mon Sep 17 00:00:00 2001 From: Perfare Date: Wed, 26 Feb 2020 02:00:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=96=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/ExecutableFormats/Macho64.cs | 2 +- Il2CppDumper/Program.cs | 55 +++++++---------------- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/Il2CppDumper/ExecutableFormats/Macho64.cs b/Il2CppDumper/ExecutableFormats/Macho64.cs index 3c3b94b..a85fb90 100644 --- a/Il2CppDumper/ExecutableFormats/Macho64.cs +++ b/Il2CppDumper/ExecutableFormats/Macho64.cs @@ -176,7 +176,7 @@ namespace Il2CppDumper public override bool PlusSearch(int methodCount, int typeDefinitionsCount) { - var data = sections.Where(x => x.sectname == "__const").ToArray(); + var data = sections.Where(x => x.sectname == "__const" || x.sectname == "__cstring" || x.sectname == "__data").ToArray(); var code = sections.Where(x => x.flags == 0x80000400).ToArray(); var bss = sections.Where(x => x.flags == 1u).ToArray(); diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index 1afd9d7..dbcaacf 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -17,8 +17,6 @@ namespace Il2CppDumper config = JsonConvert.DeserializeObject(File.ReadAllText(Application.StartupPath + Path.DirectorySeparatorChar + @"config.json")); byte[] il2cppBytes = null; byte[] metadataBytes = null; - string stringVersion = null; - int mode = 0; if (args.Length == 1) { @@ -28,15 +26,11 @@ namespace Il2CppDumper return; } } - if (args.Length > 3) + if (args.Length > 2) { ShowHelp(); return; } - if (args.Length > 2) - { - mode = int.Parse(args[2]); - } if (args.Length > 1) { var file1 = File.ReadAllBytes(args[0]); @@ -76,7 +70,7 @@ namespace Il2CppDumper } try { - if (Init(il2cppBytes, metadataBytes, stringVersion, mode, out var metadata, out var il2Cpp)) + if (Init(il2cppBytes, metadataBytes, out var metadata, out var il2Cpp)) { Dump(metadata, il2Cpp); } @@ -95,7 +89,7 @@ namespace Il2CppDumper Application.ExitThread(); } - private static bool Init(byte[] il2cppBytes, byte[] metadataBytes, string stringVersion, int mode, out Metadata metadata, out Il2Cpp il2Cpp) + private static bool Init(byte[] il2cppBytes, byte[] metadataBytes, out Metadata metadata, out Il2Cpp il2Cpp) { var sanity = BitConverter.ToUInt32(metadataBytes, 0); if (sanity != 0xFAB11BAF) @@ -177,17 +171,23 @@ namespace Il2CppDumper il2Cpp = new Macho64(il2CppMemory, version, metadata.maxMetadataUsages); else il2Cpp = new Macho(il2CppMemory, version, metadata.maxMetadataUsages); + Console.WriteLine($"Il2Cpp Version: {il2Cpp.Version}"); - if (mode == 0) - { - Console.WriteLine("Select Mode: 1.Manual 2.Auto"); - var modeKey = Console.ReadKey(true); - mode = int.Parse(modeKey.KeyChar.ToString()); - } + Console.WriteLine("Searching..."); try { - if (mode == 1) + var flag = il2Cpp.PlusSearch(metadata.methodDefs.Count(x => x.methodIndex >= 0), metadata.typeDefs.Length); + if (!flag) { + flag = il2Cpp.Search(); + } + if (!flag) + { + flag = il2Cpp.SymbolSearch(); + } + if (!flag) + { + Console.WriteLine("ERROR: Can't use auto mode to process file, try manual mode."); Console.Write("Input CodeRegistration: "); var codeRegistration = Convert.ToUInt64(Console.ReadLine(), 16); Console.Write("Input MetadataRegistration: "); @@ -195,29 +195,6 @@ namespace Il2CppDumper il2Cpp.Init(codeRegistration, metadataRegistration); return true; } - else if (mode == 2) - { - Console.WriteLine("Searching..."); - var flag = il2Cpp.PlusSearch(metadata.methodDefs.Count(x => x.methodIndex >= 0), metadata.typeDefs.Length); - if (!flag) - { - flag = il2Cpp.Search(); - } - if (!flag) - { - flag = il2Cpp.SymbolSearch(); - } - if (!flag) - { - Console.WriteLine("ERROR: Can't use auto mode to process file, try manual mode."); - return false; - } - } - else - { - Console.WriteLine("ERROR: You have to choose a mode."); - return false; - } } catch (Exception e) {