-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathverify_stealth.ts
More file actions
61 lines (51 loc) · 2.14 KB
/
Copy pathverify_stealth.ts
File metadata and controls
61 lines (51 loc) · 2.14 KB
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
import { PuppeteerStealthEngine } from './src/infrastructure/browser/PuppeteerStealthEngine';
import { FingerprintService } from './src/infrastructure/browser/FingerprintService';
import { logger } from './src/infrastructure/logging/logger';
async function verify() {
const engine = new PuppeteerStealthEngine();
const fingerprint = FingerprintService.generate();
logger.info('Starting verification', {
ua: fingerprint.userAgent,
platform: fingerprint.platform
});
await engine.init({
userAgent: fingerprint.userAgent,
viewport: fingerprint.viewport,
platform: fingerprint.platform,
fingerprintScript: FingerprintService.getInjectionScript(fingerprint),
headless: true // Run headless for verification
});
try {
const url = 'https://bot.sannysoft.com/';
logger.info(`Navigating to ${url}`);
await engine.navigate(url);
await engine.wait(5000); // Wait for tests to complete
const screenshotPath = './verification_sannysoft.png';
// We don't have a direct screenshot tool in BrowserEngine yet,
// but we can access the internal page if needed or just check for specific text.
const results = await engine.evaluate(() => {
const items = document.querySelectorAll('.table-striped tr');
const data: Record<string, string> = {};
items.forEach(item => {
const key = item.querySelector('td:first-child')?.textContent?.trim();
const val = item.querySelector('td:last-child')?.textContent?.trim();
if (key && val) data[key] = val;
});
return data;
});
logger.info('Verification Results:', results);
// Check for common red flags
const failures = Object.entries(results).filter(([k, v]) => v.toLowerCase().includes('fail') || v.toLowerCase().includes('broken'));
if (failures.length > 0) {
logger.warn('Stealth Leaks Detected!', { failures });
} else {
logger.info('Stealth Verification Passed! No obvious leaks found.');
}
} catch (err) {
logger.error('Verification failed', { err });
} finally {
// Note: engine.close() or similar would be good if implemented
process.exit(0);
}
}
verify();