azizniiby commited on
Commit
2c07357
·
verified ·
1 Parent(s): 56c4cfe

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
  title: Cf
3
- emoji: 🏃
4
- colorFrom: gray
5
- colorTo: pink
6
- sdk: gradio
7
- sdk_version: 6.2.0
8
- app_file: app.py
9
- pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Cf
3
+ emoji: 🏢
4
+ colorFrom: purple
5
+ colorTo: purple
6
+ sdk: docker
7
+ sdk_version: 5.49.1
8
+ license: apache-2.0
9
+ short_description: bypass cf
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
cache/cache.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "{\"domain\":\"https://v2links.org\",\"mode\":\"iuam\"}": {
3
+ "timestamp": 1758616160392,
4
+ "value": {
5
+ "cf_clearance": "qqs5f4MpFMgA0v78Qmh_HYDWoKhbwqlQ57bTW5KeIr8-1758616161-1.2.1.1-D5PdpmheHl.26ssIRKQBsXzPtPPkSXntEZ_H9FUJVt7MMTS_BEE8iH.E48MDzKtFBLwZqRYxE_1GLo1gj3ChXrwatOGEJcmGRUwavy2qvGgUPizn7qufd.sW0ULfhaRO7Gz_H_eO1TU3iEqCzltEUDNk0SviKRFkF8ozbvJ91MW_qmO.qrjQorbu_jxcgJv5BHs6rTNOitWtVDAmYMDukASq0viHXIUAIvTM.LIfQ88",
6
+ "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
7
+ "elapsed_time": 5.028
8
+ }
9
+ }
10
+ }
endpoints/cloudflare.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function cloudflare(data, page) {
2
+ return new Promise(async (resolve, reject) => {
3
+ if (!data.domain) return reject(new Error("Missing domain parameter"))
4
+
5
+ const startTime = Date.now()
6
+ let isResolved = false
7
+ let userAgent = null
8
+
9
+ const cl = setTimeout(() => {
10
+ if (!isResolved) {
11
+ isResolved = true
12
+ const elapsedTime = (Date.now() - startTime) / 1000
13
+ resolve({
14
+ cf_clearance: null,
15
+ user_agent: userAgent,
16
+ elapsed_time: elapsedTime,
17
+ })
18
+ }
19
+ }, 20000)
20
+
21
+ try {
22
+ if (data.proxy?.username && data.proxy?.password) {
23
+ await page.authenticate({
24
+ username: data.proxy.username,
25
+ password: data.proxy.password,
26
+ })
27
+ }
28
+
29
+ page.removeAllListeners("request")
30
+ page.removeAllListeners("response")
31
+ await page.setRequestInterception(true)
32
+
33
+ page.on("request", async (req) => {
34
+ try {
35
+ await req.continue()
36
+ } catch (_) {}
37
+ })
38
+
39
+ page.on("response", async (res) => {
40
+ try {
41
+ const url = res.url()
42
+ if (url.includes("/cdn-cgi/challenge-platform/")) {
43
+ const headers = res.headers()
44
+ if (headers["set-cookie"]) {
45
+ const match = headers["set-cookie"].match(/cf_clearance=([^;]+)/)
46
+ if (match) {
47
+ const cf_clearance = match[1]
48
+ const userAgent = (await res.request().headers())["user-agent"]
49
+ const elapsedTime = (Date.now() - startTime) / 1000
50
+
51
+ if (!isResolved) {
52
+ isResolved = true
53
+ clearTimeout(cl)
54
+
55
+ resolve({
56
+ cf_clearance,
57
+ user_agent: userAgent,
58
+ elapsed_time: elapsedTime,
59
+ })
60
+ }
61
+ }
62
+ }
63
+ }
64
+ } catch (_) {}
65
+ })
66
+
67
+ await page.goto(data.domain, { waitUntil: "domcontentloaded" })
68
+ userAgent = await page.evaluate(() => navigator.userAgent)
69
+ } catch (err) {
70
+ if (!isResolved) {
71
+ isResolved = true
72
+ clearTimeout(cl)
73
+ reject(err)
74
+ }
75
+ }
76
+ })
77
+ }
78
+
79
+ module.exports = cloudflare
endpoints/recaptchav2.js ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function recaptchaV2({ domain, proxy, siteKey, action = "submit", isInvisible = false }, page) {
2
+ if (!domain) throw new Error("Missing domain parameter");
3
+ if (!siteKey) throw new Error("Missing siteKey parameter");
4
+
5
+ const timeout = global.timeOut || 60000;
6
+ let isResolved = false;
7
+
8
+ const cl = setTimeout(async () => {
9
+ if (!isResolved) {
10
+ throw new Error("Timeout Error");
11
+ }
12
+ }, timeout);
13
+
14
+ try {
15
+ if (proxy?.username && proxy?.password) {
16
+ await page.authenticate({
17
+ username: proxy.username,
18
+ password: proxy.password,
19
+ });
20
+ }
21
+
22
+ const htmlContent = `
23
+ <!DOCTYPE html>
24
+ <html lang="en">
25
+ <head>
26
+ <meta charset="UTF-8">
27
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
28
+ <title>reCAPTCHA v2 Solver</title>
29
+ <style>
30
+ body {
31
+ font-family: Arial, sans-serif;
32
+ margin: 0;
33
+ padding: 20px;
34
+ background: #f5f5f5;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ min-height: 100vh;
39
+ }
40
+ .container {
41
+ background: white;
42
+ padding: 30px;
43
+ border-radius: 10px;
44
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
45
+ text-align: center;
46
+ }
47
+ .status {
48
+ margin-top: 20px;
49
+ padding: 10px;
50
+ border-radius: 5px;
51
+ background: #f8f9fa;
52
+ }
53
+ button {
54
+ background: #007bff;
55
+ color: white;
56
+ border: none;
57
+ padding: 10px 20px;
58
+ border-radius: 5px;
59
+ cursor: pointer;
60
+ margin: 10px;
61
+ }
62
+ button:hover {
63
+ background: #0056b3;
64
+ }
65
+ </style>
66
+ </head>
67
+ <body>
68
+ <div class="container">
69
+ <h2>reCAPTCHA v2 Solver</h2>
70
+ <p>SiteKey: ${siteKey}</p>
71
+ <div id="recaptcha-container">
72
+ <div class="g-recaptcha"
73
+ data-sitekey="${siteKey}"
74
+ data-callback="recaptchaCallback"
75
+ data-expired-callback="recaptchaExpired"
76
+ data-error-callback="recaptchaError"
77
+ data-size="${isInvisible ? 'invisible' : 'normal'}"
78
+ data-theme="light">
79
+ </div>
80
+ </div>
81
+ ${isInvisible ? '<button onclick="executeInvisible()">Execute reCAPTCHA</button>' : ''}
82
+ <button onclick="checkToken()">Check Token</button>
83
+ <div class="status" id="status">Waiting for reCAPTCHA...</div>
84
+ </div>
85
+
86
+ <script>
87
+ // Global variables
88
+ window.recaptchaToken = null;
89
+ window.recaptchaSolved = false;
90
+
91
+ // Callback functions
92
+ window.recaptchaCallback = function(token) {
93
+ console.log('reCAPTCHA token received:', token);
94
+ window.recaptchaToken = token;
95
+ window.recaptchaSolved = true;
96
+
97
+ document.getElementById('status').innerHTML = '✅ reCAPTCHA Solved! Token: ' + token.substring(0, 20) + '...';
98
+ document.getElementById('status').style.background = '#d4edda';
99
+ document.getElementById('status').style.color = '#155724';
100
+
101
+ // Store token in multiple ways
102
+ var input = document.createElement('input');
103
+ input.type = 'hidden';
104
+ input.name = 'g-recaptcha-response';
105
+ input.value = token;
106
+ input.id = 'recaptcha-token-input';
107
+ document.body.appendChild(input);
108
+
109
+ localStorage.setItem('recaptcha_token', token);
110
+ };
111
+
112
+ window.recaptchaExpired = function() {
113
+ console.log('reCAPTCHA expired');
114
+ window.recaptchaToken = null;
115
+ window.recaptchaSolved = false;
116
+ document.getElementById('status').innerHTML = '❌ reCAPTCHA Expired - Refreshing...';
117
+ document.getElementById('status').style.background = '#fff3cd';
118
+ document.getElementById('status').style.color = '#856404';
119
+
120
+ var existing = document.getElementById('recaptcha-token-input');
121
+ if (existing) existing.remove();
122
+
123
+ // Auto-refresh after expiration
124
+ setTimeout(() => {
125
+ if (window.grecaptcha) {
126
+ grecaptcha.reset();
127
+ }
128
+ }, 1000);
129
+ };
130
+
131
+ window.recaptchaError = function() {
132
+ console.log('reCAPTCHA error');
133
+ document.getElementById('status').innerHTML = '❌ reCAPTCHA Error';
134
+ document.getElementById('status').style.background = '#f8d7da';
135
+ document.getElementById('status').style.color = '#721c24';
136
+ };
137
+
138
+ window.executeInvisible = function() {
139
+ if (window.grecaptcha) {
140
+ grecaptcha.execute();
141
+ }
142
+ };
143
+
144
+ window.checkToken = function() {
145
+ const token = window.recaptchaToken || document.getElementById('recaptcha-token-input')?.value;
146
+ if (token) {
147
+ document.getElementById('status').innerHTML = 'Token: ' + token;
148
+ } else {
149
+ document.getElementById('status').innerHTML = 'No token yet';
150
+ }
151
+ };
152
+
153
+ // Auto-execute for invisible reCAPTCHA
154
+ window.onload = function() {
155
+ setTimeout(function() {
156
+ // For invisible reCAPTCHA, auto-execute
157
+ if (${isInvisible} && window.grecaptcha) {
158
+ grecaptcha.execute();
159
+ }
160
+
161
+ // For visible reCAPTCHA, try to find and click
162
+ if (!${isInvisible}) {
163
+ var iframe = document.querySelector('iframe[src*="recaptcha"]');
164
+ if (iframe) {
165
+ console.log('Attempting to interact with reCAPTCHA');
166
+ var rect = iframe.getBoundingClientRect();
167
+ var clickEvent = new MouseEvent('click', {
168
+ view: window,
169
+ bubbles: true,
170
+ cancelable: true,
171
+ clientX: rect.left + rect.width / 2,
172
+ clientY: rect.top + rect.height / 2
173
+ });
174
+ iframe.dispatchEvent(clickEvent);
175
+ }
176
+ }
177
+ }, 2000);
178
+ };
179
+ </script>
180
+
181
+ <!-- Load reCAPTCHA API -->
182
+ <script src="https://www.google.com/recaptcha/api.js" async defer></script>
183
+ </body>
184
+ </html>
185
+ `;
186
+
187
+ // Setup request interception
188
+ await page.setRequestInterception(true);
189
+ page.removeAllListeners("request");
190
+
191
+ page.on("request", async (request) => {
192
+ const url = request.url();
193
+
194
+ // Handle main document request
195
+ if ([domain, domain + "/"].includes(url) && request.resourceType() === "document") {
196
+ await request.respond({
197
+ status: 200,
198
+ contentType: "text/html",
199
+ body: htmlContent,
200
+ });
201
+ }
202
+ // Block unnecessary resources untuk mempercepat
203
+ else if (request.resourceType() === 'image' ||
204
+ request.resourceType() === 'stylesheet' ||
205
+ request.resourceType() === 'font') {
206
+ await request.abort();
207
+ }
208
+ else {
209
+ await request.continue();
210
+ }
211
+ });
212
+
213
+ // Navigate ke page
214
+ await page.goto(domain, {
215
+ waitUntil: "domcontentloaded",
216
+ timeout: timeout
217
+ });
218
+
219
+ // Tunggu reCAPTCHA container load
220
+ await page.waitForSelector('.g-recaptcha', { timeout: 10000 });
221
+
222
+ // Tunggu token tersedia dengan multiple strategies
223
+ const token = await page.waitForFunction(() => {
224
+ // Cek dari hidden input
225
+ const input = document.querySelector('#recaptcha-token-input');
226
+ if (input && input.value && input.value.length > 10) {
227
+ return input.value;
228
+ }
229
+
230
+ // Cek dari localStorage
231
+ const stored = localStorage.getItem('recaptcha_token');
232
+ if (stored && stored.length > 10) {
233
+ return stored;
234
+ }
235
+
236
+ // Cek dari global variable
237
+ if (window.recaptchaToken && window.recaptchaToken.length > 10) {
238
+ return window.recaptchaToken;
239
+ }
240
+
241
+ return null;
242
+ }, { timeout, polling: 100 });
243
+
244
+ const tokenValue = await token.jsonValue();
245
+
246
+ isResolved = true;
247
+ clearTimeout(cl);
248
+
249
+ if (!tokenValue || tokenValue.length < 10) {
250
+ throw new Error("Failed to get valid reCAPTCHA token");
251
+ }
252
+
253
+ console.log('Successfully obtained reCAPTCHA token');
254
+ return { token: tokenValue, type: 'recaptcha_v2' };
255
+
256
+ } catch (error) {
257
+ clearTimeout(cl);
258
+
259
+ // Fallback: coba ambil token dengan method lain
260
+ try {
261
+ const fallbackToken = await page.evaluate(() => {
262
+ const input = document.querySelector('#recaptcha-token-input');
263
+ return input ? input.value : null;
264
+ });
265
+
266
+ if (fallbackToken && fallbackToken.length > 10) {
267
+ return { token: fallbackToken, type: 'recaptcha_v2' };
268
+ }
269
+ } catch (e) {
270
+ // Ignore fallback error
271
+ }
272
+
273
+ throw new Error(`reCAPTCHA solving failed: ${error.message}`);
274
+ }
275
+ }
276
+
277
+ module.exports = recaptchaV2;
endpoints/turnstile.js ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function turnstile({ domain, proxy, siteKey }, page) {
2
+ if (!domain) throw new Error("Missing domain parameter");
3
+ if (!siteKey) throw new Error("Missing siteKey parameter");
4
+
5
+ const timeout = global.timeOut || 60000;
6
+ let isResolved = false;
7
+
8
+ const cl = setTimeout(async () => {
9
+ if (!isResolved) {
10
+ throw new Error("Timeout Error");
11
+ }
12
+ }, timeout);
13
+
14
+ try {
15
+ if (proxy?.username && proxy?.password) {
16
+ await page.authenticate({
17
+ username: proxy.username,
18
+ password: proxy.password,
19
+ });
20
+ }
21
+
22
+ const htmlContent = `
23
+ <!DOCTYPE html>
24
+ <html lang="en">
25
+ <body>
26
+ <div class="turnstile"></div>
27
+ <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback" defer></script>
28
+ <script>
29
+ window.onloadTurnstileCallback = function () {
30
+ turnstile.render('.turnstile', {
31
+ sitekey: '${siteKey}',
32
+ callback: function (token) {
33
+ var c = document.createElement('input');
34
+ c.type = 'hidden';
35
+ c.name = 'cf-response';
36
+ c.value = token;
37
+ document.body.appendChild(c);
38
+ },
39
+ });
40
+ };
41
+ </script>
42
+ </body>
43
+ </html>
44
+ `;
45
+
46
+ await page.setRequestInterception(true);
47
+ page.removeAllListeners("request");
48
+ page.on("request", async (request) => {
49
+ if ([domain, domain + "/"].includes(request.url()) && request.resourceType() === "document") {
50
+ await request.respond({
51
+ status: 200,
52
+ contentType: "text/html",
53
+ body: htmlContent,
54
+ });
55
+ } else {
56
+ await request.continue();
57
+ }
58
+ });
59
+
60
+ await page.goto(domain, { waitUntil: "domcontentloaded" });
61
+
62
+ await page.waitForSelector('[name="cf-response"]', { timeout });
63
+
64
+ const token = await page.evaluate(() => {
65
+ try {
66
+ return document.querySelector('[name="cf-response"]').value;
67
+ } catch {
68
+ return null;
69
+ }
70
+ });
71
+
72
+ isResolved = true;
73
+ clearTimeout(cl);
74
+
75
+ if (!token || token.length < 10) throw new Error("Failed to get token");
76
+ return token;
77
+
78
+ } catch (e) {
79
+ clearTimeout(cl);
80
+ throw e;
81
+ }
82
+ }
83
+
84
+ module.exports = turnstile;