Forgets commited on
Commit
04a0477
·
verified ·
1 Parent(s): 295e6a3

Update Api/recaptcha2.js

Browse files
Files changed (1) hide show
  1. Api/recaptcha2.js +34 -32
Api/recaptcha2.js CHANGED
@@ -1,6 +1,8 @@
1
  /**
2
- * API_RECAPTCHA2 - Hybrid Version with Auto-Trigger
3
  */
 
 
4
  async function recaptchaV2({ domain, siteKey, action = "submit", isInvisible = false, proxy }, page) {
5
  if (!domain) throw new Error("Missing domain parameter");
6
  if (!siteKey) throw new Error("Missing siteKey parameter");
@@ -13,7 +15,7 @@ async function recaptchaV2({ domain, siteKey, action = "submit", isInvisible = f
13
  const cl = setTimeout(() => {
14
  if (!isResolved) {
15
  isResolved = true;
16
- reject(new Error("Timeout Error: rektCaptcha Extension Unresponsive"));
17
  }
18
  }, timeout);
19
 
@@ -23,53 +25,51 @@ async function recaptchaV2({ domain, siteKey, action = "submit", isInvisible = f
23
  <html lang="en">
24
  <head>
25
  <meta charset="UTF-8">
26
- <title>reCAPTCHA Solver</title>
27
  <script src="https://www.google.com/recaptcha/api.js" async defer></script>
28
  <style>
29
- body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f0f2f5; margin: 0; }
30
- .box { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
31
  </style>
32
  </head>
33
  <body>
34
  <div class="box">
35
- <div class="g-recaptcha" data-sitekey="${siteKey}" data-size="${isInvisible ? 'invisible' : 'normal'}"></div>
36
  <textarea id="g-recaptcha-response" name="g-recaptcha-response" style="display:none"></textarea>
37
  </div>
38
  </body>
39
  </html>
40
  `;
41
 
42
- await page.setRequestInterception(true);
43
- page.removeAllListeners("request");
44
- page.on("request", async (req) => {
45
- const url = req.url();
46
- if ([domain, domain + "/"].includes(url) && req.resourceType() === "document") {
47
- await req.respond({ status: 200, contentType: "text/html", body: htmlContent });
48
- } else if (["image", "font", "media"].includes(req.resourceType())) {
49
- await req.abort();
50
- } else {
51
- await req.continue();
52
- }
53
- });
54
-
55
- console.log(`[SOLVER] Loading target...`);
56
  await page.goto(domain, { waitUntil: "networkidle2", timeout });
57
 
58
- // --- TRICK: FORCE CLICK CHECKBOX ---
59
- console.log("[SOLVER] Attempting to trigger reCAPTCHA checkbox...");
60
- try {
61
- await page.waitForSelector('iframe[title*="reCAPTCHA"]', { timeout: 10000 });
62
- const frames = await page.frames();
63
- const recaptchaFrame = frames.find(f => f.url().includes('api2/anchor'));
64
 
65
- if (recaptchaFrame) {
66
- await recaptchaFrame.click('#recaptcha-anchor');
67
- console.log("[SOLVER] Checkbox clicked! Waiting for extension...");
68
- }
69
- } catch (e) {
70
- console.log("[SOLVER] Warning: Could not click checkbox, extension might fail.");
71
  }
72
 
 
 
 
 
 
 
 
 
73
  // --- POLLING TOKEN ---
74
  const tokenValue = await page.waitForFunction(() => {
75
  const input = document.querySelector('#g-recaptcha-response');
@@ -84,6 +84,8 @@ async function recaptchaV2({ domain, siteKey, action = "submit", isInvisible = f
84
  if (!isResolved) {
85
  isResolved = true;
86
  clearTimeout(cl);
 
 
87
  reject(new Error(`Bypass failed: ${error.message}`));
88
  }
89
  }
 
1
  /**
2
+ * API_RECAPTCHA2 - Debug Mode (No Abort + Auto Screenshot)
3
  */
4
+ const fs = require('fs');
5
+
6
  async function recaptchaV2({ domain, siteKey, action = "submit", isInvisible = false, proxy }, page) {
7
  if (!domain) throw new Error("Missing domain parameter");
8
  if (!siteKey) throw new Error("Missing siteKey parameter");
 
15
  const cl = setTimeout(() => {
16
  if (!isResolved) {
17
  isResolved = true;
18
+ reject(new Error("Timeout Error: Check debug_captcha.png in your Space files"));
19
  }
20
  }, timeout);
21
 
 
25
  <html lang="en">
26
  <head>
27
  <meta charset="UTF-8">
28
+ <title>reCAPTCHA Debugger</title>
29
  <script src="https://www.google.com/recaptcha/api.js" async defer></script>
30
  <style>
31
+ body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #ffffff; margin: 0; }
32
+ .box { border: 1px solid #ccc; padding: 20px; border-radius: 8px; }
33
  </style>
34
  </head>
35
  <body>
36
  <div class="box">
37
+ <div class="g-recaptcha" data-sitekey="${siteKey}"></div>
38
  <textarea id="g-recaptcha-response" name="g-recaptcha-response" style="display:none"></textarea>
39
  </div>
40
  </body>
41
  </html>
42
  `;
43
 
44
+ // Matikan REQ ABORT agar semua aset (gambar/css) dimuat
45
+ await page.setRequestInterception(false);
46
+
47
+ console.log(`[SOLVER] Navigating to target...`);
 
 
 
 
 
 
 
 
 
 
48
  await page.goto(domain, { waitUntil: "networkidle2", timeout });
49
 
50
+ // Suntikkan HTML (menggunakan evaluate karena interception dimatikan)
51
+ await page.evaluate((html) => {
52
+ document.documentElement.innerHTML = html;
53
+ }, htmlContent);
54
+
55
+ await new Promise(r => setTimeout(r, 5000));
56
 
57
+ // --- TRIGGER CLICK ---
58
+ console.log("[SOLVER] Clicking checkbox...");
59
+ const frames = await page.frames();
60
+ const anchorFrame = frames.find(f => f.url().includes('api2/anchor'));
61
+ if (anchorFrame) {
62
+ await anchorFrame.click('#recaptcha-anchor');
63
  }
64
 
65
+ // Tunggu proses ekstensi (15 detik)
66
+ await new Promise(r => setTimeout(r, 15000));
67
+
68
+ // --- AMBIL SCREENSHOT UNTUK DEBUG ---
69
+ console.log("[SOLVER] Taking debug screenshot...");
70
+ await page.screenshot({ path: 'debug_captcha.png', fullPage: true });
71
+ console.log("[SOLVER] Screenshot saved as debug_captcha.png");
72
+
73
  // --- POLLING TOKEN ---
74
  const tokenValue = await page.waitForFunction(() => {
75
  const input = document.querySelector('#g-recaptcha-response');
 
84
  if (!isResolved) {
85
  isResolved = true;
86
  clearTimeout(cl);
87
+ // Ambil screenshot saat error juga
88
+ await page.screenshot({ path: 'debug_error.png' });
89
  reject(new Error(`Bypass failed: ${error.message}`));
90
  }
91
  }