Update index.js
Browse files
index.js
CHANGED
|
@@ -134,45 +134,40 @@ async function handleCloudflare(page, url) {
|
|
| 134 |
return;
|
| 135 |
}
|
| 136 |
|
| 137 |
-
const
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
const
|
| 143 |
-
|
| 144 |
-
const
|
| 145 |
-
if (
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
}
|
|
|
|
|
|
|
| 149 |
}
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 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 |
|