DD Captcha Solver

Minimal captcha solver UI with token submission or view-only mode

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         DD Captcha Solver
// @namespace    dd-captcha-solver
// @version      1.3
// @description  Minimal captcha solver UI with token submission or view-only mode
// @match        *://*/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
  try {
    const params = new URLSearchParams(location.search);
    const ddmode = params.get("ddmode");
    const siteKey = params.get("sitekey");
    const captchaId = params.get("captchaid");
    const viewOnly = params.get("viewonly") === "1";

    if (!ddmode || !siteKey || !captchaId) return;

    /* ---------------- UI ---------------- */

    document.open();
    document.write(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Solve The Captcha</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
  body {
    margin: 0;
    height: 100vh;
    background: radial-gradient(circle at top, #111827, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    color: #e5e7eb;
  }

  .box {
    text-align: center;
    padding: 40px 32px;
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    min-width: 320px;
  }

  h1 {
    font-size: 26px;
    margin-bottom: 24px;
    letter-spacing: 0.4px;
  }

  #captcha {
    display: flex;
    justify-content: center;
    margin-top: 10px;
  }

  .done {
    font-size: 18px;
    color: #22c55e;
    margin-bottom: 8px;
  }

  .sub {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 10px;
  }

  textarea {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    background: #020617;
    color: #e5e7eb;
    border: 1px solid rgba(148,163,184,0.2);
    resize: none;
    font-size: 12px;
  }
</style>
</head>
<body>
  <div class="box" id="root">
    <h1>Solve The Captcha</h1>
    <div id="captcha"></div>
  </div>
</body>
</html>
`);
    document.close();

    /* ---------------- Helpers ---------------- */

    function loadScript(src) {
      return new Promise((resolve, reject) => {
        const s = document.createElement("script");
        s.src = src;
        s.async = true;
        s.defer = true;
        s.onload = resolve;
        s.onerror = reject;
        document.head.appendChild(s);
      });
    }

    function postToken(token) {
      const xhr = new XMLHttpRequest();
      xhr.open("POST", "https://captcha.bypassbot.workers.dev/", true);
      xhr.setRequestHeader("Content-Type", "application/json");
      xhr.send(JSON.stringify({
        captchaid: captchaId,
        token: token
      }));
    }

    function onSolved(token) {
      const root = document.getElementById("root");

      if (viewOnly) {
        root.innerHTML = `
          <div class="done">✅ Captcha Solved (View Only)</div>
          <div class="sub">
            <textarea readonly onclick="this.select()">${token}</textarea>
            Click to copy token
          </div>
        `;
      } else {
        postToken(token);
        root.innerHTML = `
          <div class="done">✅ Captcha Is Solved</div>
          <div class="sub">You can go back safely.</div>
        `;
      }
    }

    /* ---------------- Engines ---------------- */

    const ENGINES = {
      v2: {
          src: "https://www.google.com/recaptcha/api.js?render=explicit",
          render() {
              const wait = setInterval(() => {
                  if (
                      window.grecaptcha &&
                      typeof grecaptcha.render === "function" &&
                      typeof grecaptcha.ready === "function"
                  ) {
                      clearInterval(wait);

                      grecaptcha.ready(() => {
                          grecaptcha.render("captcha", {
                              sitekey: siteKey,
                              callback: onSolved
                          });
                      });
                  }
              }, 50);
          }
      },


      hcaptcha: {
        src: "https://js.hcaptcha.com/1/api.js?render=explicit",
        render() {
          hcaptcha.render("captcha", {
            sitekey: siteKey,
            callback: onSolved
          });
        }
      }
    };

    /* ---------------- Boot ---------------- */

    const engine = ENGINES[ddmode];
    if (!engine) return;

    loadScript(engine.src).then(engine.render);

  } catch (e) {
    console.error("DD Captcha Solver error:", e);
  }
})();