How niklashigi/apk-mitm works
File structure
• bin/apk-mitm: the shim that invokes dist/cli.js when you run apk-mitm
• src/cli.ts & src/index.ts: argument parsing and high-level orchestration
• src/tasks/: each file here is one step in the pipeline (decode, modify manifest, inject network config, disable pinning, encode, sign, plus subfolder for Smali-level patches)
• src/tools/: wrappers around external binaries (Apktool, Uber-APK-Signer)
• src/utils/: low-level helpers (file system, downloads, process spawning, error reporting, globbing)
• README.md: explains features, flow, external dependencies (Java, apktool, uber-apk-signer), CLI parameters, and troubleshooting
Key insights from the README
• 5-stage pipeline: decode → patch manifest/NW config → patch Smali → re-encode → sign
• Uses Apktool (Java) and Uber-APK-Signer (Java) under the hood
• Offers a --wait hook for manual modifications
• Can handle both APKs and App Bundles (XAPK/APKS requires zip/unzip)
Detail
• Interplay between the Task Modules and the Tool Wrappers
• Utility layer as a shared service invoked by multiple components
• Do not oversimplify—include the Java VM and JARs as first-class nodes so that the complete end-to-end flow is visible