CLI/GUI: Support AAB files

This commit is contained in:
Katy Coe
2020-09-17 10:00:47 +02:00
parent 0e3b80b502
commit 2afdc8b421
5 changed files with 14 additions and 14 deletions

View File

@@ -20,10 +20,10 @@ namespace Il2CppInspector.CLI
{ {
private class Options private class Options
{ {
[Option('i', "bin", Required = false, Separator = ',', HelpText = "IL2CPP binary, APK or IPA input file(s) (single file or comma-separated list for split APKs)", Default = new[] { "libil2cpp.so" })] [Option('i', "bin", Required = false, Separator = ',', HelpText = "IL2CPP binary, APK, AAB or IPA input file(s) (single file or comma-separated list for split APKs)", Default = new[] { "libil2cpp.so" })]
public IEnumerable<string> BinaryFiles { get; set; } public IEnumerable<string> BinaryFiles { get; set; }
[Option('m', "metadata", Required = false, HelpText = "IL2CPP metadata file input (ignored for APK/IPA)", Default = "global-metadata.dat")] [Option('m', "metadata", Required = false, HelpText = "IL2CPP metadata file input (ignored for APK/AAB/IPA)", Default = "global-metadata.dat")]
public string MetadataFile { get; set; } public string MetadataFile { get; set; }
[Option('c', "cs-out", Required = false, HelpText = "C# output file (when using single-file layout) or path (when using per namespace, assembly or class layout)", Default = "types.cs")] [Option('c', "cs-out", Required = false, HelpText = "C# output file (when using single-file layout) or path (when using per namespace, assembly or class layout)", Default = "types.cs")]

View File

@@ -381,7 +381,7 @@ namespace Il2CppInspector
} }
#region Loaders #region Loaders
// Finds and extracts the metadata and IL2CPP binary from one or more APK files, or one IPA file into MemoryStreams // Finds and extracts the metadata and IL2CPP binary from one or more APK files, or one AAB or IPA file into MemoryStreams
// Returns null if package not recognized or does not contain an IL2CPP application // Returns null if package not recognized or does not contain an IL2CPP application
public static (MemoryStream Metadata, MemoryStream Binary)? GetStreamsFromPackage(IEnumerable<string> packageFiles, bool silent = false) { public static (MemoryStream Metadata, MemoryStream Binary)? GetStreamsFromPackage(IEnumerable<string> packageFiles, bool silent = false) {
try { try {
@@ -401,8 +401,8 @@ namespace Il2CppInspector
// There are three possibilities: // There are three possibilities:
// - A single IPA file containing global-metadata.dat and a single binary supporting one or more architectures // - A single IPA file containing global-metadata.dat and a single binary supporting one or more architectures
// (we return the binary inside the IPA to be loaded by MachOReader for single arch or UBReader for multi arch) // (we return the binary inside the IPA to be loaded by MachOReader for single arch or UBReader for multi arch)
// - A single APK file containing global-metadata.dat and one or more binaries (one per architecture) // - A single APK or AAB file containing global-metadata.dat and one or more binaries (one per architecture)
// (we return the entire APK to be loaded by APKReader) // (we return the entire APK or AAB to be loaded by APKReader or AABReader)
// - Multiple APK files, one of which contains global-metadadata.dat and the others contain one binary each // - Multiple APK files, one of which contains global-metadadata.dat and the others contain one binary each
// (we return all of the binaries re-packed in memory to a new Zip file, to be loaded by APKReader) // (we return all of the binaries re-packed in memory to a new Zip file, to be loaded by APKReader)
foreach (var file in packageFiles) { foreach (var file in packageFiles) {
@@ -492,7 +492,7 @@ namespace Il2CppInspector
} }
} }
// Load from an IPA or one or more APK files // Load from an AAB, IPA or one or more APK files
public static List<Il2CppInspector> LoadFromPackage(IEnumerable<string> packageFiles, bool silent = false) { public static List<Il2CppInspector> LoadFromPackage(IEnumerable<string> packageFiles, bool silent = false) {
var streams = GetStreamsFromPackage(packageFiles, silent); var streams = GetStreamsFromPackage(packageFiles, silent);
if (!streams.HasValue) if (!streams.HasValue)

View File

@@ -451,7 +451,7 @@
<TextBlock TextAlignment="Center"> <TextBlock TextAlignment="Center">
<TextBlock FontSize="22">Option 2</TextBlock> <TextBlock FontSize="22">Option 2</TextBlock>
<LineBreak/> <LineBreak/>
<TextBlock>Select or drag &amp; drop one or more APK files or an IPA file</TextBlock> <TextBlock>Select or drag &amp; drop one or more APK files, an AAB or IPA file</TextBlock>
<LineBreak/> <LineBreak/>
<TextBlock FontSize="16">Encrypted IPA files are not supported</TextBlock> <TextBlock FontSize="16">Encrypted IPA files are not supported</TextBlock>
</TextBlock> </TextBlock>

View File

@@ -137,11 +137,11 @@ namespace Il2CppInspectorGUI
} }
/// <summary> /// <summary>
/// Select APK or IPA package files /// Select APK, AAB or IPA package files
/// </summary> /// </summary>
private async void BtnSelectPackageFile_OnClick(object sender, RoutedEventArgs e) { private async void BtnSelectPackageFile_OnClick(object sender, RoutedEventArgs e) {
var openFileDialog = new OpenFileDialog { var openFileDialog = new OpenFileDialog {
Filter = "Android/iOS Application Package (*.apk;*.ipa;*.zip)|*.apk;*.ipa;*.zip|All files (*.*)|*.*", Filter = "Android/iOS Application Package (*.apk;*.aab;*.ipa;*.zip)|*.apk;*.aab;*.ipa;*.zip|All files (*.*)|*.*",
CheckFileExists = true, CheckFileExists = true,
Multiselect = true Multiselect = true
}; };
@@ -545,14 +545,14 @@ namespace Il2CppInspectorGUI
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop); string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
if (grdFirstPage.Visibility == Visibility.Visible) { if (grdFirstPage.Visibility == Visibility.Visible) {
// Metadata or APK/IPA // Metadata or APK/AAB/IPA
if (files.Length == 1) { if (files.Length == 1) {
switch (files[0].ToLower()) { switch (files[0].ToLower()) {
case var s when s.EndsWith(".dat"): case var s when s.EndsWith(".dat"):
await LoadMetadataAsync(s); await LoadMetadataAsync(s);
break; break;
case var s when s.EndsWith(".apk") || s.EndsWith(".ipa") || s.EndsWith(".zip"): case var s when s.EndsWith(".apk") || s.EndsWith(".aab") || s.EndsWith(".ipa") || s.EndsWith(".zip"):
await LoadPackageAsync(s); await LoadPackageAsync(s);
break; break;
} }

View File

@@ -41,7 +41,7 @@ You can read more about IL2CPP in my series [IL2CPP Reverse Engineering](https:/
File format and architecture support: File format and architecture support:
* Supports ELF (Android .so), PE (Windows .exe), Mach-O (Apple iOS/Mac), Universal Binary (Fat Mach-O) and FSELF (PlayStation 4 .prx/.sprx) file formats * Supports ELF (Android .so), PE (Windows .exe), Mach-O (Apple iOS/Mac), Universal Binary (Fat Mach-O) and FSELF (PlayStation 4 .prx/.sprx) file formats
* Also supports single and split APK (Android) and decrypted IPA (iOS) application package files as input * Also supports single and split APK (Android), AAB (Android App Bundle) and decrypted IPA (iOS) application package files as input
* 32-bit and 64-bit support for all file formats * 32-bit and 64-bit support for all file formats
* Supports ARMv7, Thumb-2, ARMv8 (A64), x86 and x64 architectures regardless of file format * Supports ARMv7, Thumb-2, ARMv8 (A64), x86 and x64 architectures regardless of file format
* Supports applications created with Unity 5.3.0 onwards (full IL2CPP version table below) * Supports applications created with Unity 5.3.0 onwards (full IL2CPP version table below)
@@ -109,9 +109,9 @@ Run `Il2CppInspector.exe` at the command prompt.
File format and architecture are automatically detected. File format and architecture are automatically detected.
``` ```
-i, --bin (Default: libil2cpp.so) IL2CPP binary, APK or IPA input file(s) (single file or comma-separated list for split APKs) -i, --bin (Default: libil2cpp.so) IL2CPP binary, APK, AAB or IPA input file(s) (single file or comma-separated list for split APKs)
-m, --metadata (Default: global-metadata.dat) IL2CPP metadata file input (ignored for APK/IPA) -m, --metadata (Default: global-metadata.dat) IL2CPP metadata file input (ignored for APK/AAB/IPA)
-c, --cs-out (Default: types.cs) C# output file (when using single-file layout) or path (when using per namespace, assembly or class layout) -c, --cs-out (Default: types.cs) C# output file (when using single-file layout) or path (when using per namespace, assembly or class layout)