-
Notifications
You must be signed in to change notification settings - Fork 0
Collapse file tree
Files
Search this repository
/
Copy pathPosting Test.mjs
More file actions
More file actions
Latest commit
489 lines (406 loc) · 18.4 KB
/
Posting Test.mjs
File metadata and controls
489 lines (406 loc) · 18.4 KB
You must be signed in to make or propose changes
More edit options
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
import { connect } from "puppeteer-real-browser";
import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';
// import FingerprintProtector from './soyjak-fingerprinter.mjs';
import MargeService from "./MargeService.mjs";
// import { newInjectedPage } from 'fingerprint-injector';
import { createCursor } from 'ghost-cursor'; // Simulates realistic human mouse movement.
import axios from 'axios'; // for the localhost usage LOL, yes I think this is very funny OY VEY LOL HAHAHA .. NIGGER FUNNY LOL
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
//create a database keep track of the accounts
function makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
async function checkStatus(taskId) {
try {
const response = await axios.get('http://localhost:3000/api/queue', {
params: { task_id: taskId },
});
const data = response.data; // ✅ Axios auto-parses JSON
if (data.success) {
return data;
}
// Task missing → treat as completed (worker removed)
if (data.error === 'Task not found') {
return { status: 'completed', task_id: taskId };
}
throw new Error(data.error || 'Unknown error');
} catch (err) {
console.error('checkStatus error:', err.message);
throw err;
}
}
async function pollStatus(taskId, intervalMs = 2000, maxAttempts = 90) {
let attempts = 0;
return new Promise((resolve, reject) => {
const poll = async () => {
attempts++;
try {
const status = await checkStatus(taskId);
console.log(`[${attempts}] Status: ${status.status}`);
if (status.status === 'completed' || status.status === 'done') return resolve(status);
if (status.status === 'failed' || status.status === 'error') return reject(new Error('Task failed'));
if (attempts >= maxAttempts) return reject(new Error('Max polling attempts reached'));
setTimeout(poll, intervalMs);
} catch (err) {
reject(err);
}
};
poll();
});
}
// new axios-based getWorkerQueue()
async function getWorkerQueue(result) {
try {
const data = JSON.parse(result.body);
const base64Image = data.base64Image;
const guid = data.guid;
const response = await axios.post(
"http://localhost:3000/api/queue",
{
image: base64Image,
submittedBy: "James",
},
{
headers: {
"accept": "*/*",
"content-type": "application/json",
"cache-control": "no-cache",
"pragma": "no-cache",
"referer": "http://localhost:3000/",
},
withCredentials: true,
}
);
let body = response.data;
if (typeof body === "string") {
try {
body = JSON.parse(body);
} catch {
// leave as text
}
}
// ✅ return both API response body and guid
return { ...body, guid };
} catch (error) {
console.error("Error in getWorkerQueue:", error.message);
return {
status: error.response?.status || 0,
ok: false,
body: error.response?.data || error.message,
};
}
}
///////////////////////////////////////////////
async function test() {
let browser = null;
let page = null;
// const jihad = await (await import('puppeteer-extra-plugin-stealth')).default
// const pajeet = await (await import('puppeteer-with-fingerprints')).default
const jshelterPath = path.join(__dirname, 'jsrestrictor-0.21');
try {
//Hard modify
// intercept xhr.js , and remove tinytimeouts lol
// chrome --timezone=Asia/Hong_Kong --lang=zh-CN --accept-lang=zh-CN,en -- =121e0opwlltx --user-data-dir=./my_user_data
const connection = await connect({
headless: false,
plugins: [
// pajeet()
],
args: [
'--lang=en-US', // sets the browser language to English,
'--accept-lang=en-US,en',
// '--disable-webrtc', // Not always reliable
// `--disable-extensions-except=${jshelterPath}`,
// `--load-extension=${jshelterPath}`,
'--no-sandbox',
// '--disable-gpu',
// '--aggressive-cache-discard',
// '--disable-site-isolation-trials',
// '--disable-gpu-sandbox',
// '--disable-features=WebRtcHideLocalIps', // Hide local IPs
// '--disable-ip-handling-policy', // Force proxy-only IPs
// '--disable-blink-features=TimezoneDetection',
// '--webrtc-ip-handling-policy=disable_non_proxied_udp',
// '--force-webrtc-ip-handling-policy',
// '--disable-speech-api',
'--fingerprint='+(Math.floor(Math.random() * 0x100000000)).toString(),
'--fingerprint-platform=windows',
'--timezone=America/New_York',
'--cpucores=6',
'--fingerprint-gpu-vendor',
// '--port_whitelist=[61255,1080]',11044572221bdad7a80b384f9690e475d6decb7ea35fac146ddd0301cd259e3f
// '--utility-sub-type=storage.mojom.StorageService',
// '--type=utility',
// '--service-sandbox-type=service',
// '--no-pre-read-main-dll',
// '--window-position=0,0',
'--enable-features=AllowURNsInIframes,BrowsingTopics,ConversionMeasurement,FencedFrames,Fledge,FledgeNegativeTargeting,InterestGroupStorage,OverridePrivacySandboxSettingsLocalTesting,PrivacySandboxAdsAPIsOverride,PrivateAggregationApi,SharedStorageAPI',
'--disable-features=ChromeWhatsNewUI,ExtensionsToolbarMenu,LensOverlay,PrintCompositorLPAC,ReadLater,TriggerNetworkDataMigration,ViewportHeightClientHintHeader',
// '--mojo-platform-channel-handle=2836',
// '/prefetch:8',
// '--use-fake-ui-for-media-stream',
// '--use-fake-device-for-media-stream',
],
// customConfig: { chromePath: `C:\\Users\\User\\AppData\\Local\\BraveSoftware\\Brave-Browser\\Application\\brave.exe` },
// "C:\Users\User\AppData\Roaming\adspower_global\cwd_global\chrome_138\sunbrowser.exe" -
// customConfig: { chromePath: `C:\\Users\\User\\AppData\\Roaming\\adspower_global\\cwd_global\\chrome_138\\sunbrowser.exe` },
// customConfig: { chromePath: `C:\\Users\\User\\AppData\\Local\\Chromium\\Application\\chrome.exe` },
customConfig: { chromePath: `C:\\Users\\User\\mlx\\deps\\mimic_140.3\\chrome.exe` },
// :\Users\User\mlx\deps\mimic_140.3\chrome.exe
turnstile: false,
connectOption: {},
disableXvfb: true,
ignoreAllFlags: false,
// proxy: {
// host: '15.204.151.143',
// port: '31158',
// username: '',
// password: ''
// }
});
browser = connection.browser;
page = connection.page;
const cursor = createCursor(page); // Attach the ghost cursor for human-like interaction.
// page = await newInjectedPage(browser, {//rest in piss, now detected
// fingerprintOptions: {
// devices: ['desktop'],
// operatingSystems: ['windows'],
// slim: true,
// mockWebRTC: false,
// },
// });
// const protector = new FingerprintProtector();
// await protector.protectPage(page);
await page.setRequestInterception(true);
page.on('request', request => {
try {
let url = request.url();
if (
url.includes('hash-wasm@')
// || url.includes('voice_room_data.php')
// // // || url.includes('STATUS_data') // now detected?
// || url.includes('ruffle.js')
// || url.includes('_expand-video.js')
// || url.includes('.css')
// || url.includes('b3.php')
) {
console.log('Blocked request:', url);
return request.abort();
}
if (request.resourceType() === 'image') {
return request.abort();
}
if (request.method() === 'POST') {
if (request.postData()) {
if (url.includes('/post.php')) {
// console.log('POST data:', request.postData());
}
}
}
request.continue();
} catch (err) {
try { request.continue(); } catch (_) { }
}
});
// await page.setViewport({ width: 1000, height: 1080 });
// const timezones = Intl.supportedValuesOf('timeZone');
// const randomTZ = timezones[Math.floor(Math.random() * timezones.length)];
// await page.emulateTimezone("America/New_York");
// await page.emulateTimezone("Europe/Prague");
// await page.emulateTimezone(randomTZ);
// Optional: set Accept-Language in request headers
// await page.setExtraHTTPHeaders({
// 'Accept-Language': 'en-US,en;q=0.9'
// });
// await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0')
https://browserleaks.com/webgl
// await page.goto("https://fv.pro/",{ timeout: 60022222});await sleep(30022222);
// await page.goto("https://browserleaks.com/webgl",{ timeout: 60022222});await sleep(30022222);
// / // await page.goto("https://abrahamjuliot.github.io/creepjs",{ timeout: 60022222});await sleep(30022222);
// await page.goto("https://bot-detector.rebrowser.net/",{ timeout: 60022222});await sleep(30022222);
// await page.goto("https://webbrowsertools.com/canvas-fingerprint/",{ timeout: 60022222});await sleep(30022222);
// await page.goto("https://soyjak.st/",{ waitUntil: ['load', 'domcontentloaded', 'networkidle0'] });
// await page.goto("https://soyjak.st/challenge-check.html");
await page.goto("https://soyjak.st/challenge.html");
const service = new MargeService();
await service.solvePowIfNeeded(page);
await page.goto("https://soyjak.st/soy/",
);
// await sleep(8000);
await page.waitForSelector('textarea#body');
// await page.evaluate(() => {
// const btn = document.querySelector('#show-captcha-button');
const blob = new Blob([arrayBuffer], { type: type });
const file = new File([blob], name, { type: type });
dataTransfer.items.add(file);
});
const dragEnterEvent = new DragEvent('dragenter', {
bubbles: true,
cancelable: true,
dataTransfer: dataTransfer
});
dropzone.dispatchEvent(dragEnterEvent);
const dropEvent = new DragEvent('drop', {
bubbles: true,
cancelable: true,
dataTransfer: dataTransfer
});
dropzone.dispatchEvent(dropEvent);
}, fileDataArray);
await page.waitForSelector('.tmb-container', { timeout: 5000 });
console.log('Files uploaded successfully!');
const fileCount = await page.evaluate(() => {
return document.querySelectorAll('.tmb-container').length;
});
console.log(`Number of files added: ${fileCount}`);
await page.evaluate(() => {
const nsfwCheckbox = document.querySelector('.file-nsfw');
if (nsfwCheckbox) {
nsfwCheckbox.checked = false;
}
});
await page.evaluate(() => {
const spoilerCheckboxes = document.querySelectorAll('.file-spoiler');
if (spoilerCheckboxes[1]) {
spoilerCheckboxes[1].checked = false;
}
});
await page.click('input[name="post"][type="submit"]');
await page.waitForNavigation({ waitUntil: 'networkidle0' })
// await sleep(4);
// await sleep(900222220);
} catch (e) {
console.log('Error occurred:', e);
} finally {
// Only close browser if it was successfully created
if (browser) {
try {
await browser.close();
console.log('Browser closed successfully');
} catch (closeError) {
console.log('Error closing browser:', closeError);
}
}
}
}
async function t() {
while (true) {
try {
await test();
} catch (e) { console.log(e) }
}
}
t();