Skip to content

A new, unified, application analysis utility#10267

Open
grendello wants to merge 91 commits intomainfrom
dev/grendel/apput
Open

A new, unified, application analysis utility#10267
grendello wants to merge 91 commits intomainfrom
dev/grendel/apput

Conversation

@grendello
Copy link
Contributor

@grendello grendello commented Jul 3, 2025

Summary

Add apput (under tools/apput/), a standalone .NET console tool for inspecting and extracting data from Android application packages produced by .NET for Android. It replaces several separate ad-hoc utilities with a single, extensible tool that can auto-detect file formats and operate on APKs, AABs, assembly stores, ELF shared libraries, individual .NET assemblies, PDBs, and binary Android manifests.

Usage

dotnet run --project tools/apput/src/apput.csproj -- <input_file>
dotnet run --project tools/apput/src/apput.csproj -- --help

The default command is report, which generates a Markdown analysis of the input file. Pass -l - to output the report to the console with VT100 color rendering.

Available commands

Command Description
report <input_file> Generate a full Markdown report (default)
extract assembly [options] <input_file> [patterns...] Extract .NET assemblies and PDBs from APK/AAB/assembly stores
extract manifest <input_file> Extract AndroidManifest.xml as plain XML

Examples

# Analyze an APK (default report command)
./dotnet-local.sh run --project tools/apput/src/apput.csproj -- path/to/app.apk

# Extract all assemblies from an AAB
./dotnet-local.sh run --project tools/apput/src/apput.csproj -- extract assembly -o ./out path/to/app.aab

# Extract manifest
./dotnet-local.sh run --project tools/apput/src/apput.csproj -- extract manifest path/to/app.apk

Supported file formats

The tool auto-detects the input format via Detector.FindAspect():

  • APK / AAB — Android application packages
  • Assembly store (v2/v3) — compressed assembly collections (including assemblies.*.blob.so)
  • .NET assemblies — individual PE/MSIL .dll files
  • PDB debug symbol files
  • ELF shared libraries — with sub-type detection for NativeAOT, Mono AOT, Xamarin runtime, .NET Android wrapper, and assembly-embedded .so files
  • Binary AndroidManifest.xml

Architecture & extensibility

apput is designed around an Aspect abstraction — each file format is an IAspect implementation that can be probed, loaded, reported on, and extracted from. New formats can be added by:

  1. Implementing IAspect (with ProbeAspect / LoadAspect static methods)
  2. Adding an [AspectReporter]-annotated reporter class
  3. Optionally adding an [AspectExtractor]-annotated extractor class

Key entry points for programmatic use:

Class Purpose
Detector FindAspect(stream) / FindAspect(path) — detect file format
Extractor Extract<TStored>(aspect, destination) — extract data from a container
Reporter Report(aspect, ...) — generate Markdown report
LogBuffer Implement and pass to Log.SetLogBuffer to capture log output programmatically

Notes

  • The tool is not currently included in any .sln file — it is built standalone via dotnet run --project.
  • Report output is Markdown, optionally color-rendered via VT100 when writing to an interactive terminal.
  • Assembly extraction supports architecture filtering, glob/regex patterns, and optional PDB extraction.
  • Future work: could be distributed as a dotnet tool, integrated into CI for APK analysis, or used as a library from Copilot skills or IDE extensions.

@grendello grendello force-pushed the dev/grendel/apput branch 5 times, most recently from d46c313 to 4428b80 Compare July 14, 2025 16:46
@grendello grendello force-pushed the dev/grendel/apput branch from 4428b80 to 28ba499 Compare July 15, 2025 14:41
@grendello grendello force-pushed the dev/grendel/apput branch 3 times, most recently from ac8ee22 to a970710 Compare August 22, 2025 09:41
@grendello grendello force-pushed the dev/grendel/apput branch 5 times, most recently from 2d2b75f to 5853f30 Compare September 26, 2025 14:49
@grendello grendello force-pushed the dev/grendel/apput branch 2 times, most recently from d5c13d8 to 0fe21d2 Compare October 16, 2025 15:02
@grendello grendello force-pushed the dev/grendel/apput branch 2 times, most recently from 27f76e3 to d064436 Compare February 2, 2026 10:33
@grendello grendello force-pushed the dev/grendel/apput branch 2 times, most recently from 5995cdd to 6f506da Compare February 6, 2026 21:19
@grendello grendello force-pushed the dev/grendel/apput branch 6 times, most recently from c54ea3b to 2f8d731 Compare February 26, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants