Skip to content
uwuclxdyPublic

About

Automated Android bloatware classification pipeline for UAD-ng

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

uadclaw

Automatic LLM-driven bloat classification of Android apps, from official OEM firmware to a reviewed UAD-ng pull request.

A FastAPI dashboard drives a worker through ten pipeline stages. A human approves every package before it ships upstream.

license ci


uadclaw pulls official OEM firmware and extracts every preinstalled APK. It derives what the manifests can prove, then classifies the rest with an LLM. Every candidate passes a human gate before it becomes a pull request to UAD-ng. The deterministic half never touches a paid API. The model can only raise a rating above a computed floor, never lower one.

the triage queue: ranked candidate cards with keyboard decisions

Why

  • Deterministic first, model last. acquire through rule_ladder read the firmware bytes and the manifests. The LLM writes the description and proposes a removal; dependencies and neededBy never come from the model. Every field carries its provenance: rule:, graph:, llm:, human:.
  • The rule ladder sets a floor the model can raise, never lower. coreApp, priv-app, sharedUserId and friends pin a danger tier. A below-floor answer is rejected, never clamped.
  • LLM spend is a separate job, never an automatic step. A firmware job ends at the rule ladder. A human queues the classification job that pays the API.
  • Every model answer faces an external check. A Brave search and a judge pass look for independent support. A citation the judge was never handed refuses the whole response.
  • The evidence bundle is the reproducibility anchor. It is content-addressed and pinned, because the LLM has no seed. The same bundle hash means the same question.
  • Nothing pushes itself. Approved entries are appended to a local branch with the disclosure upstream requires. A human pushes and opens the PR.

How it works

stage what happens
acquire one driver per OEM pulls the newest firmware for the models the operator names
unpack dispatch on container-format magic numbers; ext4 via 7z, EROFS via fsck.erofs, Samsung .enc4 decrypted in the driver
extract facts androguard reads each APK manifest into typed facts, merged across devices by package name
corpus graph two dependency edge classes only: overlay-to-target and required-library provider to consumer
filter drops what is already in uad_lists.json, auto-generated RROs, and emulator-only packages
rule ladder the removal floor from manifest and /etc signals; the model may raise it, never lower it
llm the LLM writes the description and proposes a removal; below-floor answers are rejected
corroborate Brave search plus a judge pass; a fabricated citation refuses the whole response
triage keyboard-driven human gate, ranked by device count; decisions land in an append-only log
branch approved entries are appended to the operator's clone of upstream; the PR body carries the disclosure

LLM providers

One OpenAI-format client serves every provider. The provider table in settings (LLM_PROVIDERS, or a mounted secrets file under the secrets/ dir the install section names) names each provider with its base url, model, thinking flag, output ceiling and concurrency; one key file per provider id sits beside it (secrets/llm_<id>_key or LLM_<ID>_KEY). A classification job's params may name any id in the table, validated at creation and stored on the job row; jobs that name none use LLM_DEFAULT_PROVIDER (deepseek). An unknown id is a 422 at creation, never a failed worker. The table carries no credential, so both containers read it: the web process validates at creation and the worker spends. thinking: false sends the DeepSeek-specific {"thinking": {"type": "disabled"}} wire field, so settings load refuses it on any entry that is not deepseek (by id deepseek or a base_url on api.deepseek.com), naming the entry; deepseek entries keep the flag in either state.

provider models used for
DeepSeek (default) deepseek-v4-flash, deepseek-v4-pro classification and the corroboration judge

DeepSeek is the only provider measured end to end; the migration from the old DEEPSEEK_* settings to the table shape is documented in .env.example.

Install

The stack is Docker Compose: Postgres, the web dashboard, and a worker. Credentials are files under secrets/, mounted as docker secrets.

git clone https://github.com/uwuclxdy/uadclaw
cd uadclaw
uv sync --frozen
cp .env.example .env          # for from-source runs; compose reads secrets/ instead
mkdir -p secrets
printf 'a long random postgres password' > secrets/postgres_password
printf 'a long random login password'    > secrets/auth_password
printf 'a long random session secret'    > secrets/session_secret
touch secrets/llm_deepseek_key secrets/brave_key
docker compose up -d --wait postgres
docker compose run --rm web alembic upgrade head
docker compose up -d

The dashboard is at http://localhost:8000. Login is the single AUTH_PASSWORD. The two API-key files must exist and may stay empty. A blank key fails its own paid stage at the point of use, never at startup.

Note

The worker bind-mounts a scratch dir for multi-GB firmware unpack and, for branch emission, the operator's clone of upstream. Defaults are in docker-compose.yml with their one-time setup steps. For a quick local run, point WORKER_SCRATCH_DIR at a writable directory.

Usage

Everything runs from the dashboard.

  1. Queue a firmware job: pick a driver and a device, watch the stages on the jobs screen.
  2. Queue a classification job when the firmware work is done. This is the paid step.
  3. Work the triage queue. Each card shows the evidence, the model proposal, the corroboration sources, the floor, and the nearest upstream entries.
  4. Run a branch emission for one vendor batch. The PR body is on the emission row. Push the branch and open the PR by hand.

Refresh data/uad_lists.json deliberately when you want the filter to know what is new upstream:

mkdir -p data && curl -fsSL -o data/uad_lists.json https://raw.githubusercontent.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation/main/resources/assets/uad_lists.json

Configuration

Settings load from mounted docker secrets first, then the environment, then .env. Blank credentials refuse to start the app.

setting default what it does
POSTGRES_PASSWORD, AUTH_PASSWORD, SESSION_SECRET required the three credentials; mounted as files under secrets/
PIXEL_TERMS_ACK_COOKIE_VALUE unset accepts Google's factory-image terms; the Pixel driver refuses to fetch without it
SAMSUNG_MODELS / SAMSUNG_REGIONS unset the model by CSC grid the Samsung driver probes
MOTOROLA_DEVICES unset the codenames the Motorola driver crawls
LLM_PROVIDERS unset the provider table; a classification job naming a provider outside it is refused at creation
LLM_DEEPSEEK_KEY unset the default provider's key; refused at the first call, not at startup
BRAVE_KEY unset the corroboration key; blank means a classification job ends at corroborate
UPSTREAM_REPO_PATH unset the operator's clone the emission commits into
PIPELINE_COMMIT_SHA unset the commit of this pipeline; branch emission refuses without it
WORKER_SCRATCH_DIR /mnt/ssd-1/scratch host directory for firmware unpack

Every remaining key, grouped with its default and its type, is on the Configuration wiki page. The schema itself lives in src/uadclaw/settings.py and .env.example.

Comparison

uadclaw hand-curated UAD list bare LLM over package names
evidence per package manifest facts, firmware graph, one pinned bundle maintainer memory the name
safety floor rule ladder; unrepresentable to lower maintainer judgement none
external check search plus judge; fabricated citations refused none none
human gate keyboard triage, every package the maintainer, every entry none
what reaches upstream append-only insertion with disclosure direct edits whatever the model said

FAQ

What does uadclaw classify? The preinstalled APKs of official OEM firmware, minus the partitions a named list waives as appless, for the Universal Android Debloater list.

Which phones does it support? Pixel, Xiaomi, Nothing, Motorola, Samsung and Oppo/OnePlus/realme, one driver each. Unpacking dispatches on bytes, never on the OEM.

Does the model decide what gets removed? No. The rule ladder sets a floor, the model proposes, and a human approves in triage. A below-floor answer is rejected, not clamped.

Does uadclaw push to upstream? No. It commits a local branch and renders the PR body. A human pushes and opens the PR.

What does it cost to run? LLM and Brave tokens for the two paid stages. The deterministic half needs no paid keys at all.

Development

uv sync --frozen
docker compose up -d --wait postgres   # test Postgres on 127.0.0.1:55432
uv run ruff check
uv run ruff format --check
uv run pytest

The suite needs a real Postgres on loopback port 55432. docker-compose.override.yml publishes it and plain docker compose merges that file automatically, so never pass -f docker-compose.yml. The override is gitignored, so a fresh clone lacks it and every DB-backed test fails loudly rather than skipping; the Development wiki page carries the four lines to recreate it. Each pytest-xdist worker gets its own database, migrated by alembic. Heavy tests run the real extraction chain against a multi-GB image and need UADCLAW_HEAVY_TESTS=1. Run the app from source with uv run uvicorn uadclaw.asgi:app.

Documentation

The wiki is the full reference.

page covers
Firmware drivers one section per OEM: index shape, ref identity, terms posture, measured gotchas
Unpacking magic-number dispatch, the container chains, partition handling, path safety
Facts and corpus manifest facts, the cross-device merge, the dependency graph's two edge classes
Rule ladder the removal floor, the rules that set it, provenance, the queue filters
Classification the evidence bundle, the OpenAI-format LLM client, the response validator, persistence
Corroboration the two Brave clients, the SSRF gate, the judge, the fabricated-citation refusal
Jobs and worker job kinds, the per-kind stage walk, claiming, the ownership fence, scratch leases
Triage and emission the human gate, the decision log, the append-only splice, branch safety
Configuration every settings key with its default and what it gates
Deployment the compose stack, secrets, bind mounts, hardening, the build stages
Development the local loop, the test posture, migrations, what CI gates

The design doc and the domain knowledge stay in docs/, gitignored, so a checkout never carries them. Issues and PRs are welcome; CONTRIBUTING has the rules, agent formats included.

License

MIT, see LICENSE.

About

Automated Android bloatware classification pipeline for UAD-ng

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages