XORE21 commited on
Commit
3173341
·
verified ·
1 Parent(s): 64f0dd6

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +30 -35
index.js CHANGED
@@ -134,45 +134,40 @@ async function handleCloudflare(page, url) {
134
  return;
135
  }
136
 
137
- const clicked = await page.evaluate(async () => {
138
- function queryShadowDeep(root, selector) {
139
- if (!root) return null;
140
- let found = root.querySelector(selector);
141
- if (found) return found;
142
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null, false);
143
- while (walker.nextNode()) {
144
- const node = walker.currentNode;
145
- if (node.shadowRoot) {
146
- found = queryShadowDeep(node.shadowRoot, selector);
147
- if (found) return found;
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
 
 
149
  }
150
- return null;
151
- }
152
-
153
- const checkbox = queryShadowDeep(document.body, "input[type='checkbox']");
154
- if (checkbox && !checkbox.checked) {
155
- checkbox.click();
156
- return "shadow-click";
157
- }
158
-
159
- const widget = document.querySelector('.cf-turnstile') || document.querySelector('#turnstile-wrapper');
160
- if (widget) {
161
- widget.click();
162
- return "widget-click";
163
- }
164
-
165
- return false;
166
- });
167
-
168
- if (clicked) {
169
- console.log(`[Cloudflare] Interactive Widget Clicked! (${clicked})`);
170
  }
171
 
172
- try {
173
- await page.mouse.move(Math.floor(Math.random() * 500), Math.floor(Math.random() * 500));
174
- } catch (err) {}
175
-
176
  } catch (e) {}
177
  }, 1000);
178
 
 
134
  return;
135
  }
136
 
137
+ const frames = page.frames();
138
+ const challengeFrame = frames.find(f => f.url().includes("challenges.cloudflare.com") || f.url().includes("turnstile"));
139
+
140
+ if (challengeFrame) {
141
+ try {
142
+ const checkbox = await challengeFrame.$("input[type='checkbox']");
143
+ if (checkbox) {
144
+ const boundingBox = await checkbox.boundingBox();
145
+ if (boundingBox) {
146
+ console.log("[Cloudflare] Target found. Moving mouse physically...");
147
+
148
+ const x = boundingBox.x + boundingBox.width / 2 + (Math.random() - 0.5) * 5;
149
+ const y = boundingBox.y + boundingBox.height / 2 + (Math.random() - 0.5) * 5;
150
+
151
+ await page.mouse.move(x, y, { steps: 5 });
152
+ await page.waitForTimeout(100 + Math.random() * 200);
153
+ await page.mouse.down();
154
+ await page.waitForTimeout(50 + Math.random() * 50);
155
+ await page.mouse.up();
156
+
157
+ console.log("[Cloudflare] Mouse Clicked at", x, y);
158
+
159
+ await page.mouse.move(x + 100, y + 100, { steps: 10 });
160
  }
161
+ } else {
162
+ await challengeFrame.click('body', { delay: 50 }).catch(()=>{});
163
  }
164
+ } catch(e) {}
165
+ } else {
166
+ try {
167
+ await page.mouse.move(Math.floor(Math.random() * 500), Math.floor(Math.random() * 500));
168
+ } catch (err) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  }
170
 
 
 
 
 
171
  } catch (e) {}
172
  }, 1000);
173