Skip to content
This repository was archived by the owner on Aug 11, 2026. It is now read-only.

Repository files navigation

Important

请前往新版: https://github.com/bddjr/ccwfetch

用于创建CCW的A和B请求头。

搞定这两个请求头之后,您可以在携带用户 Cookie 的环境里,以用户的身份向 CCW 发起任意网络请求。

感谢 @jexjws 使用 Gemini 3 Pro AI 找到重要线索。


后端逻辑:

hmac md5 的密钥会在每次登录时生成一个,此后只要token不变,密钥就不变。

未登录时需要 guest-id 请求头,服务器会根据该请求头查找密钥,找不到就会生成一个新的密钥。


前端逻辑:

携带 Cookie 使用 POST 方法请求以下地址

https://community-web.ccw.site/health/check

响应的 JSON 里通常是以下格式

{
    "body": [
        {
            "name": "advertisement",
            "status": "DOWN",
            "traceId": "D69D698094AA414FAFB938F93D3E530E"
        },
        {
            "name": "article",
            "status": "UP",
            "traceId": "D2C4B6A1720E43bDA6CCD3962A140F57"
        },
        {
            "name": "auth",
            "status": "UP",
            "traceId": "4FCF2862DDAF495EAE369138338EF3F8"
        },
        {
            "name": "comment",
            "status": "UP",
            "traceId": "DA449A76EE50468886B4EC02CAA03C4D"
        },
        {
            "name": "notification",
            "status": "UP",
            "traceId": "DEDF7191DC7B47a58280125150B259F6"
        },
        {
            "name": "search",
            "status": "UP",
            "traceId": "74719B8B651F42FCB91532DCC19F98CD"
        },
        {
            "name": "user",
            "status": "UP",
            "traceId": "2A7e92ABB1C14A90BF6596ABD58B5E3C"
        },
        {
            "name": "websocket",
            "status": "UP",
            "traceId": "DB157973E06546c3AC8491C9E2FA5926"
        }
    ],
    "code": "200",
    "msg": null,
    "status": 200
}

使用特定逻辑提取 hmac md5 的密钥

let hmacKey = json.body.map(({ traceId }) => traceId[parseInt(traceId[0], 16) + 1]).reverse().join('')

然后在每次请求需要签名的接口时,先获得当前时间戳作为 B 请求头,
然后在 body 的前面连接 ccw ,后面连接 B 请求头,使用 hmac md5 签名作为 A 请求头即可。

const body = JSON.stringify({})
const headers = { b: Date.now().toString() }
headers.a = md5('ccw' + body + headers.b, hmacKey)

当然,也有更稳定的办法,就是直接新建一个 iframe ,从里面提取 axios ,但那样的性能开销较大。

About

用于创建CCW的A和B请求头。

Resources

Stars

1 star

Watchers

0 watching

Forks

Used by

Contributors

Languages