Skip to content
SaamoChaPublic

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

Parroteer

Automated browser fingerprint monitoring and parrot drift detection for utls and uquic.

Runs daily on GitHub Actions. Captures real TLS fingerprints from desktop browsers (via Selenium) and from Android OkHttp (via an emulator), normalizes them, compares against utls parrots, and opens a GitHub Issue when a parrot falls out of sync with its real browser. A second job does the same for QUIC: it captures the QUIC Initial packets of Chrome, Edge and Firefox and compares them with the uquic parrots.

Why

utls/uquic maintain hand-crafted "parrot" presets that mimic real browser fingerprints. When a browser changes cipher suites, extensions, or QUIC transport parameters — whether through a version bump or a silent server-side rollout — the parrots go stale. Today this is noticed manually, sometimes weeks late. Parroteer closes that gap.

How It Works

Daily cron (UTC 06:00) or manual trigger
  │
  ├─ 1. Update utls ── go get utls@master (always test latest commit)
  │
  ├─ 2. Capture ── launch real browsers (Selenium + system binaries)
  │                 + utls parrots (Go, via cmd/utls-capture)
  │                 → hit tls.browserleaks.com reflector
  │                 → get full TLS ClientHello JSON
  │
  ├─ 3. Normalize ── replace GREASE values with sentinel (preserve position)
  │                   sort randomized extension order (preserve GREASE bookends)
  │                   extract supported_versions, key_shares, sig_algs from extensions
  │                   → produce stable structural fingerprint
  │
  ├─ 4. Diff ── compare browser vs baseline (fingerprint drift detection)
  │             compare browser vs utls parrot (parrot accuracy check)
  │
  └─ 5. Notify ── known diff unchanged: log only, no Issue
                   new or changed diff: open GitHub Issue
                   baseline updated: commit back to repo

Architecture

parroteer/
├── .github/workflows/
│   └── fingerprint-watch.yml  # daily cron + manual dispatch
│
├── cmd/
│   ├── utls-capture/          # Go: capture utls parrot fingerprint via reflector
│   ├── uquic-capture/         # Go: record a uquic parrot's QUIC Initial flight offline
│   ├── gen-quic-spec/         # Go: patch a uquic parrot toward a real capture, replay it
│   ├── gen-spec/              # Go: browserleaks JSON → utls ClientHelloSpec JSON
│   ├── replay-verify/         # Go: load spec, connect via utls, verify match
│   ├── ch-compare/            # Go: compare ClientHello structures
│   └── ch-inspect/            # Go: inspect ClientHello details
│
├── internal/specgen/          # Go: spec translation library (used by gen-spec)
├── internal/quiccapture/      # Go: offline QUIC Initial capture with clienthellod
│
├── src/
│   ├── capture.ts             # Selenium: launch browser, visit reflector, get JSON
│   ├── capture-quic.ts        # Selenium: capture QUIC fingerprints via the local reflector
│   ├── normalize-quic.ts      # QUIC fingerprint normalization
│   ├── report-quic.ts         # QUIC diff + Issue formatting
│   ├── run-quic.ts            # QUIC entry point: capture → normalize → diff → notify
│   ├── normalize.ts           # strip noise, preserve GREASE positions, extract fields
│   ├── report.ts              # structural diff + format Issue body
│   └── run.ts                 # entry point: capture → normalize → diff → notify
│
├── reflector/                 # Self-hosted clienthellod reflector (TLS)
│   ├── local/Caddyfile        # Local QUIC reflector used in CI (reflector.test)
│   ├── Caddyfile              # Caddy + clienthellod modcaddy config
│   ├── setup-oracle.sh        # Install on Oracle Always Free Ubuntu
│   └── README.md
│
├── fixtures/
│   ├── baselines/             # last known browser fingerprints (committed by CI)
│   └── known-diffs/           # last seen utls-vs-browser diffs (dedup mechanism)
│
├── reports/                   # diff reports (gitignored, uploaded as CI artifacts)
├── scripts/
│   ├── install-browsers.sh    # install Chrome, Edge, Firefox (direct from vendors)
│   └── start-quic-reflector.sh # build + start the local QUIC reflector
│
├── go.mod / go.sum            # Go deps (utls, uquic, auto-updated to latest commit)
├── package.json               # Node deps (selenium-webdriver, tsx)
└── tsconfig.json

Reflector

Uses tls.browserleaks.com (root endpoint, not /json). The root endpoint returns a full tls object with per-extension detail:

  • tls.cipher_suites — [{id, name}, ...] with GREASE entries
  • tls.extensions — [{id, name, data}, ...] with nested fields:
    • ext 43 supported_versions — version list
    • ext 51 key_share — group IDs and key lengths
    • ext 13 signature_algorithms — full sig alg list
    • ext 16 alpn — protocol list

The /json endpoint only returns ja3/ja4 summaries and lacks these details.

GREASE Handling

GREASE (RFC 8701) values are not stripped — their positions are preserved as sentinel values (-1). This matters for fingerprint mimicking because:

  • Chrome always places GREASE at the start of cipher suites
  • Chrome wraps extensions with GREASE at first and last position
  • Chrome adds GREASE to supported_groups, supported_versions, key_shares
  • Firefox does not use GREASE at all

If a browser changes its GREASE placement strategy, parroteer detects it.

Chrome randomizes extension order per-connection, so the normalizer peels off GREASE bookends, sorts the interior, then re-attaches them.

Notification Dedup

utls-vs-browser diffs are saved to fixtures/known-diffs/. A hash of the diff result is compared against the last known hash:

  • Same hash → known diff, skip notification
  • Different hash → new or changed diff, open Issue
  • Parrot now matches → clear known diff record

This prevents daily duplicate Issues for the same stale parrot.

utls Version

The CI workflow runs go get github.com/refraction-networking/utls@main before each capture. This means:

  • Every run tests against the latest utls commit on main
  • If someone pushes a parrot fix to utls, the next daily run will pick it up
  • go.mod and go.sum are committed back, so you can track which utls version each run tested against

Why Selenium

Selenium always drives the real browser binary installed on the system. No patched or bundled browsers. This matters because:

  • Playwright's Firefox is a patched build — TLS fingerprint may differ from the real Firefox release
  • Playwright's WebKit is not Safari — Safari's TLS comes from Apple's OS TLS stack, unreproducible on Linux
  • Selenium uses the system-installed browser directly, so the captured fingerprint is exactly what a real user would produce

Driver management is handled by selenium-manager (built into Selenium v4+).

Browser Coverage

Current

Client Runner How
Chrome Stable ubuntu-latest scripts/install-browsers.sh + Selenium
Edge Stable ubuntu-latest scripts/install-browsers.sh + Selenium
Firefox Stable ubuntu-latest direct download from Mozilla + Selenium
Safari macos-26 system Safari + safaridriver
Android OkHttp 5.3.0 ubuntu-latest Android 16 (API 36) emulator

Planned

Browser Notes
Chrome Beta Same install script, not yet enabled
Firefox Nightly Manual download from Mozilla
iOS Safari Needs an iOS device or simulator

Normalization Fields

Field Source GREASE
cipher_suites tls.cipher_suites[].id preserved
extensions tls.extensions[].id bookends preserved, interior sorted
supported_groups ext 10 named_group_list preserved
supported_versions ext 43 versions preserved
key_share_groups ext 51 client_shares[].group.id preserved
signature_algorithms ext 13 supported_signature_algorithms preserved
alpn ext 16 protocol_name_list N/A
ec_point_formats ext 11 ec_point_format_list N/A
psk_key_exchange_mode ext 45 ke_modes N/A

Fallback: if tls object is absent (e.g. /json endpoint), parses from ja3_text + ja4_r with reduced coverage (no GREASE, no versions/key_shares).

Usage

Manual run (local)

# Install browsers (Ubuntu)
bash scripts/install-browsers.sh

# Install deps
npm ci

# Run all browsers
npx tsx src/run.ts

# Run single browser
npx tsx src/run.ts --browser chrome-stable

# Run with GitHub Issue notification
npx tsx src/run.ts --notify

GitHub Actions

The workflow runs automatically at UTC 06:00 daily. To trigger manually:

  1. Go to Actions → Fingerprint Watch
  2. Click Run workflow
  3. Optionally specify a single browser or disable notifications

Normalize a raw capture

npx tsx src/normalize.ts fixtures/captures/chrome-stable-raw.json

QUIC Pipeline

src/run-quic.ts runs in the quic job of the workflow:

  1. scripts/start-quic-reflector.sh starts a clienthellod reflector on 127.0.0.1:443 under the private name reflector.test, with its own CA. No public domain or DNS record is involved. It also sets the loopback MTU to 1500 so browsers split their Initial packets as on a real network path.
  2. Chrome and Edge are forced onto QUIC (--origin-to-force-quic-on) and accept the reflector certificate by its SPKI hash. Firefox uses network.http.http3.alt-svc-mapping-for-testing and trusts the CA through an enterprise policy.
  3. cmd/uquic-capture records each uquic parrot's Initial flight offline (no server, no handshake) and parses it with the same clienthellod version as the reflector.
  4. src/normalize-quic.ts compares packet count, frame types, the QUIC ClientHello fields and the transport parameters. It leaves out what changes per connection: DCID length, first packet number, frame order and google_initial_rtt (0x3127), which Chrome only sends once it has an RTT estimate.
  5. When a parrot differs, cmd/gen-quic-spec patches the parrot toward the real capture (transport parameters and the TLS lists a capture exposes), replays it, and adds the patch and anything still different to the report.

Run it locally (needs root for port 443):

FIREFOX_DIR=/opt/firefox-stable bash scripts/start-quic-reflector.sh   # prints QUIC_REFLECTOR_SPKI
QUIC_REFLECTOR_SPKI=... npx tsx src/run-quic.ts

Development Roadmap

Phase 1: Capture + Detect — done

  • Selenium capture for Chrome, Edge, Firefox, Safari
  • Android OkHttp capture on an emulator
  • Normalization with GREASE position preservation
  • Structural diff (field-level added/removed/changed)
  • utls parrot vs real browser comparison
  • GitHub Actions daily cron (Linux + macOS Safari)
  • Known-diff dedup (no duplicate Issues)
  • Auto-update utls to latest commit
  • Direct Mozilla download for latest Firefox (faster than apt)

Phase 2: Parrot Generation + Replay — done

  • ClientHello → utls JSON spec generator (cmd/gen-spec/)
  • Replay check (gen spec → connect to reflector → compare) (cmd/replay-verify/)
  • CI integration: auto-generate verified spec, attach to Issue
  • Self-hosted clienthellod reflector on Oracle Always Free
  • QUIC capture from real browsers (src/capture-quic.ts, manual)

Phase 3: QUIC Pipeline Integration — done

  • Local QUIC reflector in CI, no public domain (scripts/start-quic-reflector.sh)
  • uquic parrot capture for comparison (cmd/uquic-capture/)
  • QUIC normalize + diff, baselines and known-diff dedup (src/run-quic.ts)
  • uquic vs real browser comparison in CI workflow (quic job)
  • QUIC spec patch + replay (cmd/gen-quic-spec/)
  • On successful replay: open draft PR with generated Go code (not enabled)

Future

  • Chrome Beta / Firefox Nightly
  • iOS Safari via Xcode simulator
  • Auto-PR to refraction-networking/utls when spec verified

Known Challenges

Headless mode matters: Chrome's --headless=new and Firefox's -headless produce the same TLS fingerprint as headed mode. Legacy --headless (Chrome) does not.

QUIC requires two visits: Browsers use TCP on first connection. The reflector must send Alt-Svc header so the browser upgrades to QUIC on the second visit. Only relevant for QUIC capture.

Firefox and GSO on loopback: Firefox sends its two Initial packets with one GSO call. On loopback the reflector receives them as one buffer, which clienthellod cannot split, so the QUIC capture sets network.http.http3.use_nspr_for_io. The packets themselves are unchanged.

Edge on Ubuntu 24.04 runners: AppArmor restricts unprivileged user namespaces, which makes Edge abort on its SUID sandbox helper. The quic job sets kernel.apparmor_restrict_unprivileged_userns=0.

Safari depends on the macOS version: Safari's TLS fingerprint comes from the OS TLS stack, not from the Safari version. Safari 26 on macOS 15 still sends no X25519MLKEM768 key share and offers TLS 1.0/1.1, so the Safari job runs on macos-26.

License

BSD 3-Clause, see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages