File size: 6,278 Bytes
90b6287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a47cd2
 
 
 
 
 
 
 
 
 
90b6287
 
6a47cd2
 
 
 
90b6287
 
 
 
6a47cd2
 
 
90b6287
 
 
6a47cd2
90b6287
 
 
 
 
 
 
 
 
6a47cd2
90b6287
6a47cd2
90b6287
 
 
 
 
 
6a47cd2
90b6287
 
 
 
 
 
 
6a47cd2
 
90b6287
6a47cd2
90b6287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a47cd2
 
 
90b6287
 
 
6a47cd2
 
90b6287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a47cd2
90b6287
 
 
 
 
 
 
6a47cd2
 
90b6287
6a47cd2
90b6287
 
 
 
 
 
 
 
6a47cd2
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>stealth-probe</title>
<style>
  body { font-family: "Fira Mono", Menlo, monospace; background:#0d1117; color:#c9d1d9; padding:24px; }
  h1 { font-size: 1.1rem; color:#58a6ff; }
  code#jsonResult { white-space: pre; display:block; background:#161b22; padding:16px; border-radius:8px; }
  .badge { display:inline-block; padding:2px 8px; border-radius:4px; font-weight:bold; }
  .badge.bot { background:#f85149; color:#fff; }
  .badge.clean { background:#3fb950; color:#fff; }
</style>
</head>
<body>
<h1>stealth-probe — client-side automation fingerprint check</h1>
<div id="badge"></div>
<code class="language-json" id="jsonResult">{}</code>

<script>
(function () {
  "use strict";

  function safe(fn, fallback) {
    try { return fn(); } catch (e) { return fallback; }
  }

  // --- 1. Automation object leaks (Selenium / old CDP shims) ---------------
  function detectCdpLeakKeys() {
  let suspects = [
    "__webdriver_evaluate", "__selenium_evaluate", "__webdriver_script_function",
    "__webdriver_script_func", "__webdriver_script_fn", "__fxdriver_evaluate",
    "__driver_unwrapped", "__webdriver_unwrapped", "__selenium_unwrapped",
    "__fxdriver_unwrapped", "__driver_evaluate", "$cdc_asdjflasutopfhvcZLmcfl_",
    "$chrome_asyncScriptInfo", "domAutomation", "domAutomationController"
  ];
  let found = [];
  try {
    for (let i = 0; i < suspects.length; i++) {
      if (suspects[i] in window) found.push(suspects[i]);
    }
  } catch (e) {}
  try {
    let winKeys = Object.getOwnPropertyNames(window);
    for (let j = 0; j < winKeys.length; j++) {
      if (winKeys[j].indexOf("cdc_") === 0 || winKeys[j].indexOf("__webdriver") === 0) {
        found.push(winKeys[j]);
      }
    }
  } catch (e) {}
  return found;
}

  // --- 2. Function.toString native-code spoofing ---------------------------
  function functionsLookNative() {
    let fns = [window.alert, Function.prototype.bind, navigator.permissions ? navigator.permissions.query : null];
    return fns.every(function (f) {
      if (!f) return true;
      return safe(function () { return f.toString().indexOf("[native code]") !== -1; }, false);
    });
  }

  // --- 3. Canvas fingerprint sanity (blank / blocked canvas = automation tell) ---
  function canvasWorks() {
    return safe(function () {
      let c = document.createElement("canvas");
      c.width = 220; c.height = 30;
      let ctx = c.getContext("2d");
      ctx.textBaseline = "top";
      ctx.font = "14px Arial";
      ctx.fillStyle = "#f60";
      ctx.fillRect(0, 0, 220, 30);
      ctx.fillStyle = "#069";
      ctx.fillText("stealth-probe 🦊 canvas", 2, 2);
      let data = c.toDataURL();
      return data.length > 100 && data !== "data:,";
    }, false);
  }

  // --- 4. WebGL vendor/renderer consistency ---------------------------------
  function webglInfo() {
    return safe(function () {
      let c = document.createElement("canvas");
      let gl = c.getContext("webgl") || c.getContext("experimental-webgl");
      if (!gl) return { supported: false };
      let dbg = gl.getExtension("WEBGL_debug_renderer_info");
      return {
        supported: true,
        vendor: gl.getParameter(gl.VENDOR),
        renderer: gl.getParameter(gl.RENDERER),
        unmaskedVendor: dbg ? gl.getParameter(dbg.UNMASKED_VENDOR_WEBGL) : null,
        unmaskedRenderer: dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : null
      };
    }, { supported: false });
  }

  // --- 5. Headless-default screen resolution tell ---------------------------
  function hasHeadlessDefaultResolution() {
    // classic old-headless Chrome default viewport
    return (window.outerWidth === 0 || window.outerHeight === 0) ||
           (screen.width === 800 && screen.height === 600);
  }

  // --- 6. Permissions API mismatch (a known Chrome headless tell) -----------
  function permissionsInconsistent() {
    // Notification.permission === 'denied' while permissions.query resolves to 'prompt'
    // is asynchronous; we just record raw values here, evaluated further downstream if needed.
    return safe(function () {
      return typeof Notification === "undefined" ? null : Notification.permission;
    }, null);
  }

  // --- 7. Timing resolution jitter (automation frameworks sometimes clamp) --
  function timingHasJitter() {
    let samples = [];
    for (let i = 0; i < 20; i++) samples.push(performance.now());
    let allRounded = samples.every(function (v) { return v === Math.floor(v); });
    return !allRounded;
  }

  let ua = navigator.userAgent || "";
  let details = {
    hasWebdriverTrue: navigator.webdriver === true,
    hasBotUserAgent: /HeadlessChrome|bot|crawl|spider|slimerjs|phantomjs/i.test(ua),
    hasInconsistentChromeObject: /Chrome/.test(ua) && typeof window.chrome !== "object",
    hasNoPlugins: (navigator.plugins ? navigator.plugins.length : 0) === 0,
    hasNoLanguages: !(navigator.languages && navigator.languages.length),
    cdpLeakKeys: detectCdpLeakKeys(),
    functionsSpoofed: !functionsLookNative(),
    canvasBlocked: !canvasWorks(),
    webgl: webglInfo(),
    hasHeadlessDefaultScreenResolution: hasHeadlessDefaultResolution(),
    hardwareConcurrency: navigator.hardwareConcurrency || 0,
    hasHighHardwareConcurrency: (navigator.hardwareConcurrency || 0) > 32,
    notificationPermission: permissionsInconsistent(),
    hasSuspiciousTimingResolution: !timingHasJitter(),
    userAgent: ua
  };

  let isBot = details.hasWebdriverTrue ||
              details.hasBotUserAgent ||
              details.hasInconsistentChromeObject ||
              details.cdpLeakKeys.length > 0 ||
              details.functionsSpoofed ||
              details.canvasBlocked ||
              details.hasHeadlessDefaultScreenResolution;

  let result = { isBot: isBot, details: details };
  document.getElementById("jsonResult").textContent = JSON.stringify(result, null, 2);

  let badge = document.getElementById("badge");
  badge.innerHTML = '<span class="badge ' + (isBot ? "bot" : "clean") + '">' +
                     (isBot ? "DETECTED AS BOT" : "CLEAN") + "</span>";

  // Expose for Playwright evaluate() convenience without re-parsing text.
  window.__stealthProbeResult = result;
})();
</script>
</body>
</html>