Repository navigation
feat(adb): complete ADB device support for Android reverse engineering - #1552
Merged
Merged
Conversation
added 2 commits
October 10, 2026 13:28
Add a read-only ADB device-acquisition family over the caller's adb binary: inspect_adb_client, list_adb_devices, inspect_adb_device, list_adb_packages, and pull_adb_package, exposed through the CLI and MCP with shared admission, Evidence provenance (binary, version, serial, transport), and fixed argv vectors that never reach a shell. pull_adb_package acquires the complete split set reported by pm path into a package-named directory that must not exist, digesting every file with SHA-256 and keeping per-file failure reasons and partial coverage. Device kind is reported as an inference with its basis; getprop whitelisting keeps build identity bounded. REA installs nothing and never manages devices or emulators; the first device query may start the caller's local adb server, recorded when observed. Verified against adb 34.0.5 on Linux with an Android 14 (API 34) x86_64 emulator: full 224-package inventory, a real two-APK split set pulled with byte-exact digests, and a 73.9 MB system-package pull. npm run verify:adb records the lane; parser goldens come from the same device. READMEs carry the new row in every supported language.
…ifecycle tools Extend the ADB family from five to twenty-four operations, all through fixed adb argument vectors with no shell exposure: Observation: read_adb_logcat (bounded dump, count/buffer/pid), inspect_adb_package (dumpsys package projection), list_adb_processes (ps -A), list_adb_directory (ls -la with kinds and symlink targets), list_adb_features (hex GL versions), list_adb_services (AIDL slash-suffixed names), inspect_adb_display (wm size and density), inspect_adb_window (focus declarations), read_adb_setting (device-side nulls reported as such), capture_adb_screen (exec-out screencap with PNG dimensions), collect_adb_bugreport (digested device archive). Transfer and search: pull_adb_file and push_adb_file (device-side sha256sum verification, explicit overwrite authority), resolve_adb_packages (substring package search with exact-match flag — the find step of an easy get). Lifecycle for dynamic analysis, each declaring mutatesTarget: install_adb_package and uninstall_adb_package preserving the device's Success/Failure verdict, start_adb_app (resolve-activity then am start -W), start_adb_activity (typed extras as --es/--ez/--ei/--el/--ef), and stop_adb_app (am force-stop). Verified end-to-end against adb 34.0.5 on Linux with an Android 14 (API 34) x86_64 emulator: 287 services, 92 features, split-set pulls with byte-exact digests, verified push/pull roundtrip, sized screen capture, and the full install → resolve → start → observe-in-ps → force-stop → uninstall lifecycle. Fixed a v-mode regex incompatibility in the settings key pattern and added argument descriptions required by the CLI catalog audit.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
# Conflicts: # README_ar.md # README_de.md # README_es.md # README_fa.md # README_fr.md # README_ja.md # README_ko.md # README_pl.md # README_pt-BR.md # README_ru.md # README_th.md # README_tr.md # README_uk.md # README_vi.md # README_zh-TW.md # README_zh.md
Owner
|
Thanks @3QL for expanding ADB device inspection and acquisition support! This is merged, including the review fixes for remote shell quoting, cancellation, bugreport output, and screenshot file preservation. I appreciate the work across the Android tooling PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(adb): complete ADB device support for Android reverse engineering
Summary
Add an ADB family of 24 operations over the caller's
adbbinary, exposed through the same shared CLI/MCP workflows as every other analysis family. Every operation composes a fixed adb argument vector — caller values occupy positional arguments only and never reach a shell. REA never installs platform tools, never starts or manages emulators, and every result embeds the producing adb client identity (binary, selection source, version) so Evidence keeps producer provenance.Device identity and state (read-only):
inspect_adb_client·list_adb_devices(inferred emulator/physical kind with basis) ·inspect_adb_device(getprop whitelist +ro.kernel.qemu) ·inspect_adb_display·list_adb_features(hex GL versions) ·list_adb_services(AIDL/-suffixed names) ·list_adb_processes·inspect_adb_window(focus declarations) ·read_adb_setting(device-side nulls reported as such) ·read_adb_logcat(bounded dump, count/buffer/pid).Find and acquire (read-only):
resolve_adb_packages(substring search, e.g.whatsapp→com.whatsapp) ·list_adb_packages·inspect_adb_package(dumpsys projection) ·pull_adb_package(complete split APK set frompm path, each file SHA-256 digested, partial pulls keep per-file failure reasons) ·pull_adb_file·push_adb_file(e.g. tools into/data/local/tmp; refuses existing targets without explicit overwrite; verifies via the device's ownsha256sum) ·capture_adb_screen(exec-outscreencap -p, PNG dimensions) ·collect_adb_bugreport(digested device archive).Lifecycle for dynamic analysis (
mutatesTargetdeclared):install_adb_package/uninstall_adb_package(preserving the device'sSuccess/Failure [...]verdict verbatim) ·start_adb_app(resolve-activity →am start -W) ·start_adb_activity(action, URI, component, up to 16 typed extras as--es/--ez/--ei/--el/--ef) ·stop_adb_app(am force-stop). The dynamic-analysis loop is now one surface: install → start →read_adb_logcat --pid→ `stop → uninstall.This implements the read-only-plus-lifecycle ADB stage of the Android roadmap #717. UI driving (tap/type/monkey) and device-driver installs remain deliberately out of scope; see the docs' follow-up-lanes note on pairing mobile-device-mcp / Frida (#1359) behind explicit mutation authority.
Honesty rules baked in
kind_basis(serial prefix / USB transport),role_basis: file_namefor APK roles,device_reported_nullfor absent settings keys,device_digest_sourcewhen a device can't verify a push.unparsed_lines+coverage: "partial"), never silently dropped; the first run against a real device caught three real format variants this way (AIDL/names, hex feature versions,adb version's colon-lessVersionline).TOOL_EFFECTS(mutatesTarget, non-idempotent); everything else is read-only with respect to the device.Verification
#!/bin/shadb stubs (fixed-argv audits via logged argv files, digest mismatch →artifact_changed, overwrite refusals, cancellation before spawn, mistyped extras rejected pre-device), service admission/Evidence composition, CLI schema advertisement (24 commands), MCP schema parity with Ajv-validated examples and rejected unknown input.npm run verify:adb): adb 34.0.5-debian on Linux vs. an Android 14 (API 34) x86_64 emulator — every operation green: 287 binder services, 92 features, 337-process listing, bounded logcat, directory listings, a real two-APK split set pulled with byte-exact on-digest agreement, a push/pull roundtrip verified by the device's own sha256sum, a 1.3 MB screen capture with dimensions,dumpsys packageprojection, and the full lifecycle (unique resolve → launcher start viaresolve-activity+am start -W→ visible inps→ force-stop → uninstall → zero matches). System packages with non-base.apknames verify honestunknown-role reporting (73.9 MBcom.android.settings).check:fast,docs:generate,docs:check, and 3,400+ tests across the domain/services/adapters/composition projects pass. Two pre-existing environment failures in the firmware lane reproduce on a clean tree and are unrelated.Docs
docs/adb-device-analysis.md: supply tools, 24-operation table with read/mutates classification, result semantics, budgets, follow-up lanes.docs/testing.md: full verification record. README analysis table gains the "Android devices" row in English and all 17 translations.Towards #717. No engine, SDK, or emulator installation; no new runtime dependencies.