mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 10:27:42 +00:00
feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services (#13873)
* feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services * test(adb): verify feature and service paging guidance
This commit is contained in:
1 parent
1d4fadceb2
commit
11a7a34dfc
7 files changed
+64
-25
No files matched your search
@@ -101,16 +101,16 @@ existing analysis families directly, for example
|
||||
| `list_adb_devices` | read | Serial, state, transport, model metadata, inferred emulator/physical kind with basis |
|
||||
| `inspect_adb_device` | read | Fixed `getprop` whitelist: build, SDK, patch, fingerprint, product, ABIs, debuggable, `ro.kernel.qemu` |
|
||||
| `inspect_adb_display` | read | `wm size` and `wm density` as declared |
|
||||
| `list_adb_features` | read | `pm list features` (hardware/software features, hex GL versions) |
|
||||
| `list_adb_services` | read | `service list` binder services and interfaces |
|
||||
| `list_adb_processes` | read | `ps -A`: user, pid, ppid, rss, state, name; optional `limit` (1..10000) and `offset` paging |
|
||||
| `list_adb_features` | read | `pm list features` (hardware/software features, hex GL versions); optional `limit` and `offset` paging |
|
||||
| `list_adb_services` | read | `service list` binder services and interfaces; optional `limit` and `offset` paging |
|
||||
| `list_adb_processes` | read | `ps -A`: user, pid, ppid, rss, state, name; optional `limit` and `offset` paging |
|
||||
| `inspect_adb_window` | read | `dumpsys window` focus declarations (what is on screen) |
|
||||
| `read_adb_setting` | read | One `settings get` value; device-side null is reported as such |
|
||||
| `read_adb_logcat` | read | Bounded `logcat -d -t` dump for one buffer, optional pid filter |
|
||||
| `list_adb_packages` | read | `pm list packages -f` with scope; base APK device paths; optional `limit` (1..10000) and `offset` paging |
|
||||
| `list_adb_packages` | read | `pm list packages -f` with scope; base APK device paths; optional `limit` and `offset` paging |
|
||||
| `resolve_adb_packages` | read | Case-insensitive package-name substring search with exact-match flag |
|
||||
| `inspect_adb_package` | read | `dumpsys package` projection: versions, install times, installer, flags, and count of listed requested-permission rows (including Unicode names) |
|
||||
| `list_adb_directory` | read | NUL-framed immediate children, including hidden entries: kinds, permissions, owner, group, sizes, symlink targets; optional `limit` (1..10000) and `offset` paging |
|
||||
| `list_adb_directory` | read | NUL-framed immediate children, including hidden entries: kinds, permissions, owner, group, sizes, symlink targets; optional `limit` and `offset` paging |
|
||||
| `pull_adb_package` | read | Complete split APK set from `pm path`, each file digested |
|
||||
| `pull_adb_file` | read | One absolute device path pulled and digested |
|
||||
| `capture_adb_screen` | read | One `screencap -p` frame (exec-out, no device-side file) with dimensions |
|
||||
@@ -122,12 +122,6 @@ existing analysis families directly, for example
|
||||
| `start_adb_activity` | **mutates device** | Starts an intent (`am start -W -a` with optional URI, component, and up to 16 typed extras); preserves the activity manager's verdict |
|
||||
| `stop_adb_app` | **mutates device** | Force-stops every process of a package, ending a dynamic-analysis run |
|
||||
|
||||
`list_adb_packages`, `list_adb_processes`, and `list_adb_directory` accept
|
||||
optional `limit` (`1..10000`) and `offset` (`>= 0`) arguments (CLI `--limit`
|
||||
and `--offset`). Omitting both returns every parsed entry. When paging omits
|
||||
entries, `coverage` is `"partial"` and `limitations` reports the returned and
|
||||
total counts so the caller can adjust `offset` or `limit` on the next call.
|
||||
|
||||
Screen capture validates the PNG signature, IHDR framing and checksum, dimensions,
|
||||
and encoding fields before publishing. Evidence records that pixel data remains
|
||||
undecoded.
|
||||
@@ -165,13 +159,15 @@ and during shutdown.
|
||||
|
||||
## Interpret the result
|
||||
|
||||
Package, process, and directory listings accept an optional `limit` and a
|
||||
zero-based `offset` among parsed rows. Use `--limit` and `--offset` on the
|
||||
CLI. Omitting both returns the full parsed listing. Paging trims the returned
|
||||
rows after ADB captures the listing. Coverage is `partial` when rows are
|
||||
omitted or ADB output contains unparsed lines. Repeat the same operation with
|
||||
the next offset to continue. Each request captures a new listing, so rows may
|
||||
shift if device state changes between calls.
|
||||
Package, process, directory, feature, and service listings accept an optional
|
||||
positive integer `limit` and a zero-based `offset` among parsed rows. Use
|
||||
`--limit` and `--offset` on the CLI. Omitting both returns the full parsed
|
||||
listing. Paging trims the returned rows after ADB captures the listing. When
|
||||
paging omits rows, `coverage` is `partial` and the limitation reports the
|
||||
returned count, total parsed count, and selected page. Unparsed output can
|
||||
also make coverage partial. Repeat the operation with the next offset to
|
||||
continue. Each call captures a new listing, so rows may shift if device state
|
||||
changes between calls.
|
||||
|
||||
- **Package numeric declarations retain failures.** `inspect_adb_package`
|
||||
admits the first valid `userId` or `appId` as `user_id`: a nonnegative safe
|
||||
|
||||
@@ -82,10 +82,17 @@ report the resolved policy separately where needed. See the owning guides for
|
||||
[Android class search](../guides/android/android-analysis.md), and
|
||||
[Frida capture](../guides/runtime/frida-instrumentation.md).
|
||||
|
||||
ADB package, process, directory, feature, and service listings apply `limit`
|
||||
and `offset` after capturing the listing. The [ADB guide](../guides/android/adb-device-analysis.md#interpret-the-result)
|
||||
describes coverage and how to continue.
|
||||
|
||||
Frida process discovery applies `limit` and `offset` after enumerating the
|
||||
selected device. It reports `total_processes` and `truncated`. Moving to another
|
||||
page runs a fresh discovery on that device.
|
||||
|
||||
Graph tools accept per-call traversal bounds (`max_depth` and `max_nodes` on
|
||||
`get_call_graph` and `trace_call_path`).
|
||||
|
||||
The same accepted policy must reach acquisition, parsing, worker requests,
|
||||
serialization, cached-result admission and generated consumers where those
|
||||
stages exist. Desktop state views and emitted AgentEnv Python share one policy;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemas": {
|
||||
"input compact": "0eefd4f4245ea66b",
|
||||
"input compact": "f6876dac509aa36b",
|
||||
"output compact": "4bda7c3651bfc579"
|
||||
},
|
||||
"patterns": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemas": {
|
||||
"input compact": "0eefd4f4245ea66b",
|
||||
"input compact": "f6876dac509aa36b",
|
||||
"output compact": "4bda7c3651bfc579"
|
||||
},
|
||||
"patterns": {
|
||||
|
||||
@@ -1941,7 +1941,9 @@ it("lists processes, features, and services through fixed commands", async () =>
|
||||
"Found 2 services:\n 1 package: [android.content.pm.IPackageManager]\n 2 activity: [android.app.IActivityManager]\n",
|
||||
}),
|
||||
);
|
||||
const processes = await evidenceResult(providerOver(binary), {
|
||||
const provider = providerOver(binary);
|
||||
onTestFinished(() => provider.close());
|
||||
const processes = await evidenceResult(provider, {
|
||||
operation: "list_adb_processes",
|
||||
input: { serial: "emulator-5554" },
|
||||
});
|
||||
@@ -1955,7 +1957,7 @@ it("lists processes, features, and services through fixed commands", async () =>
|
||||
name: "com.example.app",
|
||||
},
|
||||
]);
|
||||
const features = await evidenceResult(providerOver(binary), {
|
||||
const features = await evidenceResult(provider, {
|
||||
operation: "list_adb_features",
|
||||
input: { serial: "emulator-5554" },
|
||||
});
|
||||
@@ -1963,7 +1965,19 @@ it("lists processes, features, and services through fixed commands", async () =>
|
||||
{ name: "android.hardware.camera", version: null },
|
||||
{ name: "android.hardware.nfc", version: 1 },
|
||||
]);
|
||||
const services = await evidenceResult(providerOver(binary), {
|
||||
const pagedFeatures = await provider.execute({
|
||||
operation: "list_adb_features",
|
||||
input: { serial: "emulator-5554", limit: 1, offset: 1 },
|
||||
});
|
||||
if (!pagedFeatures.ok) throw pagedFeatures.error;
|
||||
expect(pagedFeatures.value.result).toMatchObject({
|
||||
features: [{ name: "android.hardware.nfc", version: 1 }],
|
||||
coverage: "partial",
|
||||
});
|
||||
expect(pagedFeatures.value.limitations).toEqual([
|
||||
expect.stringMatching(/1 of 2 features.*offset 1, limit 1/u),
|
||||
]);
|
||||
const services = await evidenceResult(provider, {
|
||||
operation: "list_adb_services",
|
||||
input: { serial: "emulator-5554" },
|
||||
});
|
||||
@@ -1971,6 +1985,20 @@ it("lists processes, features, and services through fixed commands", async () =>
|
||||
{ name: "package", interface: "android.content.pm.IPackageManager" },
|
||||
{ name: "activity", interface: "android.app.IActivityManager" },
|
||||
]);
|
||||
const pagedServices = await provider.execute({
|
||||
operation: "list_adb_services",
|
||||
input: { serial: "emulator-5554", limit: 1, offset: 0 },
|
||||
});
|
||||
if (!pagedServices.ok) throw pagedServices.error;
|
||||
expect(pagedServices.value.result).toMatchObject({
|
||||
services: [
|
||||
{ name: "package", interface: "android.content.pm.IPackageManager" },
|
||||
],
|
||||
coverage: "partial",
|
||||
});
|
||||
expect(pagedServices.value.limitations).toEqual([
|
||||
expect.stringMatching(/1 of 2 services.*offset 0, limit 1/u),
|
||||
]);
|
||||
});
|
||||
|
||||
it.each(["complete", "truncated"] as const)(
|
||||
|
||||
@@ -1052,11 +1052,14 @@ export class AdbProvider {
|
||||
const { features, unparsedLines } = parseFeatureListOutput(
|
||||
ran.value.stdout,
|
||||
);
|
||||
const page = pageListingItems(features, "features", request.input);
|
||||
return ok(
|
||||
parsedListingExecution(
|
||||
{ client, serial: request.input.serial, features },
|
||||
{ client, serial: request.input.serial, features: page.items },
|
||||
unparsedLines,
|
||||
provider,
|
||||
page.limitations,
|
||||
page.truncated,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1069,11 +1072,14 @@ export class AdbProvider {
|
||||
const { services, unparsedLines } = parseServiceListOutput(
|
||||
ran.value.stdout,
|
||||
);
|
||||
const page = pageListingItems(services, "services", request.input);
|
||||
return ok(
|
||||
parsedListingExecution(
|
||||
{ client, serial: request.input.serial, services },
|
||||
{ client, serial: request.input.serial, services: page.items },
|
||||
unparsedLines,
|
||||
provider,
|
||||
page.limitations,
|
||||
page.truncated,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -336,11 +336,13 @@ export const adbInputSchemas = {
|
||||
serial: deviceSerialSchema.describe(
|
||||
"Device serial exactly as `adb devices` reports it",
|
||||
),
|
||||
...listingPagingFields,
|
||||
}),
|
||||
list_adb_services: z.strictObject({
|
||||
serial: deviceSerialSchema.describe(
|
||||
"Device serial exactly as `adb devices` reports it",
|
||||
),
|
||||
...listingPagingFields,
|
||||
}),
|
||||
inspect_adb_display: z.strictObject({
|
||||
serial: deviceSerialSchema.describe(
|
||||
|
||||
Reference in new issue
Block a user