Mobile apps
Spectral can capture traffic from Android apps by patching their APKs to trust user-installed CA certificates, then routing traffic through the MITM proxy.
Prerequisites
Section titled “Prerequisites”- adb — Android SDK Platform Tools, for communicating with the device
- java — JDK, for signing patched APKs
- A connected Android device or emulator with USB debugging enabled
Workflow overview
Section titled “Workflow overview”The full workflow is: find the package, pull the APK, patch it, install it, push the certificate, then capture traffic through the proxy. Each step has a dedicated CLI command.
Find the package
Section titled “Find the package”Search for a package by name:
spectral android list spotifyThis lists matching package names installed on the connected device (e.g., com.spotify.music).
Pull the APK
Section titled “Pull the APK”Download the APK from the device:
spectral android pull com.spotify.musicFor single APKs this produces com.spotify.music.apk. Some apps use split APKs — these are downloaded into a directory named com.spotify.music/.
Use -o to specify a custom output path.
Patch the APK
Section titled “Patch the APK”On Android 7 and later, apps only trust system CA certificates by default and ignore user-installed ones. The patch command modifies the APK to add a network security configuration that trusts user CAs, then re-signs it:
spectral android patch com.spotify.music.apkThis produces com.spotify.music-patched.apk (or a -patched/ directory for split APKs).
Install the patched APK
Section titled “Install the patched APK”spectral android install com.spotify.music-patched.apkFor split APKs, pass the directory:
spectral android install com.spotify.music-patched/Push the certificate
Section titled “Push the certificate”Push the mitmproxy CA certificate to the device:
spectral android certThis copies ~/.mitmproxy/mitmproxy-ca-cert.pem to the device’s SD card as a .crt file. You can pass a custom certificate path as an argument. If you haven’t run mitmproxy before, run it once to generate the certificate, then retry.
After pushing, install the certificate on the device: Settings > Security > Install from storage > CA certificate, then select the uploaded file.
Capture traffic
Section titled “Capture traffic”Configure the device to use the proxy. Go to Settings > Wi-Fi, long-press your network, edit the proxy settings to point to your machine’s IP address on port 8080.
Then start the proxy as usual:
spectral capture proxy -a spotify -d "*.spotify.com"Use the app on the device. The proxy captures all traffic from the patched app. Press Ctrl+C to stop. The capture is stored in managed storage.