Skip to content

Instantly share code, notes, and snippets.

@J3n5en
Last active March 22, 2026 02:14
Show Gist options
  • Select an option

  • Save J3n5en/34e122cec18930983273a740025c63d8 to your computer and use it in GitHub Desktop.

Select an option

Save J3n5en/34e122cec18930983273a740025c63d8 to your computer and use it in GitHub Desktop.

Revisions

  1. J3n5en revised this gist Jun 9, 2024. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions Frida_JD_COOKIE.js
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,16 @@ const updateWSCK = (value) => {

    const cookie = JSON.parse(envsResp).data?.find(env => env.name === "JD_COOKIE")

    const updateEnvsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs`)
    .method("PUT", RequestBody.create(MediaType.parse("application/json"), JSON.stringify({
    "value": value,
    "name": cookie.name,
    "id": cookie.id
    })))
    .addHeader("Authorization", `Bearer ${token}`).build()
    ).execute().body().string();

    const enableEnvsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs/enable`)
    .method("PUT", RequestBody.create(MediaType.parse("application/json"), JSON.stringify([cookie.id])))
  2. J3n5en revised this gist Jun 9, 2024. No changes.
  3. J3n5en revised this gist Jun 9, 2024. 1 changed file with 8 additions and 10 deletions.
    18 changes: 8 additions & 10 deletions Frida_JD_COOKIE.js
    Original file line number Diff line number Diff line change
    @@ -33,17 +33,15 @@ const updateWSCK = (value) => {

    const cookie = JSON.parse(envsResp).data?.find(env => env.name === "JD_COOKIE")

    const updateEnvsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs`)
    .method("PUT", RequestBody.create(MediaType.parse("application/json"), JSON.stringify({
    "value": value,
    "name": cookie.name,
    "id": cookie.id
    })))
    const enableEnvsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs/enable`)
    .method("PUT", RequestBody.create(MediaType.parse("application/json"), JSON.stringify([cookie.id])))
    .addHeader("Authorization", `Bearer ${token}`).build()
    ).execute().body().string();

    return JSON.parse(updateEnvsResp).code === 200



    return JSON.parse(updateEnvsResp).code === 200 && JSON.parse(enableEnvsResp).code === 200
    } catch (error) {
    return false
    }
    @@ -56,7 +54,7 @@ const hookJava = () => Java.perform(function () {
    if (updateWSCK(cookie)) {
    toast("JD_COOKIE更新成功")
    } else {
    toast("JD_COOKIE更新成功")
    toast("JD_COOKIE更新失败")
    }
    }
    });
  4. J3n5en created this gist Aug 22, 2023.
    65 changes: 65 additions & 0 deletions Frida_JD_COOKIE.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    // frida -U -F -l Frida_JD_COOKIE.js
    // 或者使用jshook注入

    const BASE_URL = "http://127.0.0.1" //青龙地址 结尾不含/
    // 青龙面板 - 系统设置 - 应用设置 中生成
    const CLIENT_ID = ""
    const CLIENT_SECRET = ""


    const toast = (text) => {
    Java.scheduleOnMainThread(function () {
    var toast = Java.use("android.widget.Toast");
    toast.makeText(Java.use("android.app.ActivityThread").currentApplication().getApplicationContext(), Java.use("java.lang.String").$new(text), 1).show();
    });
    }


    const updateWSCK = (value) => {
    try {
    const OkHttpClient = Java.use("okhttp3.OkHttpClient").$new()
    const RequestBuilder = Java.use("okhttp3.Request$Builder")
    const RequestBody = Java.use("okhttp3.RequestBody");
    const MediaType = Java.use("okhttp3.MediaType");

    const loginResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/auth/token?client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}`).build()
    ).execute().body().string();
    const token = JSON.parse(loginResp).data.token

    const envsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs`).addHeader("Authorization", `Bearer ${token}`).build()
    ).execute().body().string();

    const cookie = JSON.parse(envsResp).data?.find(env => env.name === "JD_COOKIE")

    const updateEnvsResp = OkHttpClient.newCall(
    RequestBuilder.$new().url(`${BASE_URL}/open/envs`)
    .method("PUT", RequestBody.create(MediaType.parse("application/json"), JSON.stringify({
    "value": value,
    "name": cookie.name,
    "id": cookie.id
    })))
    .addHeader("Authorization", `Bearer ${token}`).build()
    ).execute().body().string();

    return JSON.parse(updateEnvsResp).code === 200
    } catch (error) {
    return false
    }
    }

    const hookJava = () => Java.perform(function () {
    const cm = Java.use("com.tencent.smtt.sdk.CookieManager")
    const cookie = cm.getInstance().getCookie("https://m.jd.com")
    if (cookie.includes("pt_key") && cookie.includes("pt_pin")) {
    if (updateWSCK(cookie)) {
    toast("JD_COOKIE更新成功")
    } else {
    toast("JD_COOKIE更新成功")
    }
    }
    });


    setTimeout(hookJava, 3000)