High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
enhance stealth mode for better X.com compatibility
bot7d434160199f
diff --git a/main.go b/main.goindex 8450f63c..006ecacc 100644--- a/main.go+++ b/main.go@@ -47,26 +47,38 @@ func main() {chromedp.NoFirstRun,chromedp.NoDefaultBrowserCheck,- // Stealth: hide automation indicators- // Note: --disable-blink-features=AutomationControlled removed — deprecated- // in Chrome 144+, triggers warning banner. stealth.js handles navigator.webdriver.+ // Advanced stealth: hide automation indicatorschromedp.Flag("exclude-switches", "enable-automation"),+ chromedp.Flag("disable-blink-features", "AutomationControlled"),chromedp.Flag("disable-infobars", true),+ chromedp.Flag("disable-dev-shm-usage", true),+ chromedp.Flag("disable-renderer-backgrounding", true),+ chromedp.Flag("disable-background-timer-throttling", true),+ chromedp.Flag("disable-backgrounding-occluded-windows", true),+ chromedp.Flag("disable-client-side-phishing-detection", true),+ chromedp.Flag("disable-default-apps", true),+ chromedp.Flag("disable-hang-monitor", true),+ chromedp.Flag("disable-prompt-on-repost", true),+ chromedp.Flag("disable-sync", true),+ chromedp.Flag("disable-web-security", false), // Keep security enabled for realistic behavior// Performance & networkingchromedp.Flag("disable-background-networking", false),chromedp.Flag("enable-features", "NetworkService,NetworkServiceInProcess"),chromedp.Flag("disable-popup-blocking", true),- chromedp.Flag("disable-default-apps", false),chromedp.Flag("no-first-run", true),- // UI: suppress crash bar+ // UI: suppress crash bar and notificationschromedp.Flag("disable-session-crashed-bubble", true),chromedp.Flag("hide-crash-restore-bubble", true),+ chromedp.Flag("disable-device-discovery-notifications", true),- // Identity- chromedp.UserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"),- chromedp.WindowSize(1440, 900),+ // Random seed for consistent behavior across runs+ chromedp.Flag("js-flags", "--random-seed=1157259157"),++ // Identity - more realistic user agent with proper versioning+ chromedp.UserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"),+ chromedp.WindowSize(1366, 768), // More common resolution}if headless {diff --git a/stealth.js b/stealth.jsindex f4d3df69..9800ead4 100644--- a/stealth.js+++ b/stealth.js@@ -1,27 +1,98 @@-// Stealth script injected into every new document via page.AddScriptToEvaluateOnNewDocument.-// Hides automation indicators from bot detection systems.+// Enhanced stealth script injected into every new document via page.AddScriptToEvaluateOnNewDocument.+// Hides automation indicators from sophisticated bot detection systems like X.com.-// Hide webdriver flag-Object.defineProperty(navigator, 'webdriver', { get: () => undefined });+// Hide webdriver flag completely+Object.defineProperty(navigator, 'webdriver', {+ get: () => undefined,+ configurable: true+});++// Remove automation-related window properties+delete window.cdc_adoQpoasnfa76pfcZLmcfl_Array;+delete window.cdc_adoQpoasnfa76pfcZLmcfl_Promise;+delete window.cdc_adoQpoasnfa76pfcZLmcfl_Symbol;-// Fake chrome.runtime (automation detection)+// Fix chrome runtime to look more realisticif (!window.chrome) { window.chrome = {}; }-if (!window.chrome.runtime) { window.chrome.runtime = {}; }+if (!window.chrome.runtime) {+ window.chrome.runtime = {+ onConnect: undefined,+ onMessage: undefined+ };+}-// Fix notification permissions query+// Enhanced permissions APIconst originalQuery = window.navigator.permissions.query;window.navigator.permissions.query = (parameters) => (- parameters.name === 'notifications' ?- Promise.resolve({ state: Notification.permission }) :- originalQuery(parameters)+ parameters.name === 'notifications' ?+ Promise.resolve({ state: Notification.permission }) :+ originalQuery(parameters));-// Hide plugins length (headless has 0)+// Realistic plugins array (common plugins)Object.defineProperty(navigator, 'plugins', {- get: () => [1, 2, 3, 4, 5],+ get: () => [{+ name: 'Chrome PDF Plugin',+ filename: 'internal-pdf-viewer',+ description: 'Portable Document Format'+ }, {+ name: 'Chrome PDF Viewer',+ filename: 'mhjfbmdgcfjbbpaeojofohoefgiehjai',+ description: ''+ }, {+ name: 'Native Client',+ filename: 'internal-nacl-plugin',+ description: ''+ }],});-// Standard languages (headless has empty)+// Realistic language preferencesObject.defineProperty(navigator, 'languages', {- get: () => ['en-GB', 'en-US', 'en'],+ get: () => ['en-US', 'en'],+});++// Enhanced device memory (avoid detection of low-resource automation)+Object.defineProperty(navigator, 'deviceMemory', {+ get: () => 8,+});++// Hardware concurrency (realistic for modern systems)+Object.defineProperty(navigator, 'hardwareConcurrency', {+ get: () => 8,});++// Platform information (consistent with User-Agent)+Object.defineProperty(navigator, 'platform', {+ get: () => 'MacIntel',+});++// Fix missing properties that indicate automation+Object.defineProperty(navigator.connection || {}, 'rtt', {+ get: () => 100,+});++// Spoof WebGL for fingerprint resistance+const getParameter = WebGLRenderingContext.prototype.getParameter;+WebGLRenderingContext.prototype.getParameter = function(parameter) {+ // Spoof common WebGL parameters that are used for fingerprinting+ if (parameter === 37445) { // UNMASKED_VENDOR_WEBGL+ return 'Intel Inc.';+ }+ if (parameter === 37446) { // UNMASKED_RENDERER_WEBGL+ return 'Intel Iris OpenGL Engine';+ }+ return getParameter.apply(this, arguments);+};++// Mouse event realism (add slight randomness)+const originalAddEventListener = EventTarget.prototype.addEventListener;+EventTarget.prototype.addEventListener = function(type, listener, options) {+ if (type === 'mousemove' && Math.random() < 0.1) {+ // Occasionally add slight delay to make mouse movement less perfect+ const wrappedListener = function(event) {+ setTimeout(() => listener(event), Math.random() * 2);+ };+ return originalAddEventListener.call(this, type, wrappedListener, options);+ }+ return originalAddEventListener.call(this, type, listener, options);+};