File size: 3,416 Bytes
690bed1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # `awoo.cf` / `p.awoo.cf` WebSocket & Anti-Bot Architecture
Documented from browser network captures, passive DNS/HTTP inspection, and reverse engineering of client JS bundles (`app-AGKBSCUS.js`).
---
## 1. Network & Server Topology
- **Web Frontend (`https://awoo.cf`):**
- Proxied behind **Cloudflare** (`AS13335`).
- Serves HTML compressed using per-board **Zstd dictionaries** (e.g. `/assets/dictionaries/g/html-*.dict`).
- Runs a **Meguca** imageboard fork (`nekohash` client bundles).
- **Token & WebSocket Backend (`p.awoo.cf`, `p4.awoo.cf`):**
- Resolves directly (bypassing Cloudflare proxy) to DataWagon LLC infrastructure.
- Handles token issuance (`POST https://p.awoo.cf/v1/token`) and WebSocket upgrades (`wss://p.awoo.cf/api/socket`, `wss://p4.awoo.cf/api/socket`).
---
## 2. Pre-WebSocket Gate & Handshake Flow
Before opening the WebSocket, the client completes:
1. **Cloudflare Clearance:**
- Obtains `cf_clearance` and `__cf_bm` cookies on `awoo.cf`.
2. **WebSocket Gate Check:**
- `GET https://awoo.cf/api/captcha/ws-gates/status` → `{"ok": true}`
3. **WebAssembly Fingerprint Challenge:**
- `GET https://awoo.cf/api/fp-challenge` → `{"c": "<base64-challenge>"}`
- Executes `/assets/wasm/fp_seal.*.wasm` to compute and seal the browser fingerprint into cookie `mgc_fpc` (`v1.<timestamp>.<challenge>.<hmac>`).
4. **Token Binding:**
- `POST https://p.awoo.cf/v1/token` with JSON body `{"binding": "<base64url-id>"}` → returns initial token binding (`v2.<...>` structure).
---
## 3. WebSocket Upgrade & Challenge-Response Protocol
- **Upgrade Request:**
- `wss://p.awoo.cf/api/socket?binding=<binding>`
- `Sec-WebSocket-Version: 13`
- `Sec-WebSocket-Extensions: permessage-deflate`
- `Origin: https://awoo.cf`
- Required cookies: `cf_clearance`, `__cf_bm`, `meguca_gocaptcha_html`, `meguca_gocaptcha_ws`, `mgc_fpc`, `meta_pass`, `captcha_session`, `_known`.
- **6-Step Challenge Handshake:**
- Upon upgrade, the server initiates a multi-step numeric challenge before allowing any commands.
- Server sends integer `t` as string: `100000 <= t <= 1999999`.
- Client must immediately reply with `str(t + 1)`.
- This cycle repeats for 6 consecutive rounds.
- On the 6th round, the server responds with the confirmed token string (`v2.<base64...>`).
- At this point, the connection transitions to authenticated state.
- **Board / Thread Synchronization (`44`):**
- Client synchronizes by sending message type `44`:
```json
44{
"board": "all",
"thread": null,
"protocolVersion": 1,
"loginData": null,
"seal": "noWASM",
"fp": "<token>",
"meta_pass": "<meta_pass>"
}
```
- For a specific thread (e.g. `/g/1256858`), set `"board": "g"` and `"thread": 1256858`.
- The server streams initial sync state:
- `50`: Server time / sync counter
- `56`: Captcha & session data
- `55`: Board configuration
- `63`: Thread presence count
- `44`: Thread and post catalog state
- **Real-Time Event Streaming:**
- `01`: New post created (`INSERT_POST`)
- `02`: Real-time text append (`APPEND`)
- `04`: Real-time text splice (`SPLICE`)
- `05`: Post finished / closed (`CLOSE_POST`)
- `06`: Image attachment (`INSERT_IMAGE`)
- **Keepalive Ping:**
- Client sends message `48` periodically (every 15–20 seconds) as a NOOP ping to prevent idle connection closure.
|