Skip to content

Instantly share code, notes, and snippets.

@T1ckbase
Last active August 22, 2025 06:24
Show Gist options
  • Save T1ckbase/3b762018076f5068292d6ebdc914e77c to your computer and use it in GitHub Desktop.
Save T1ckbase/3b762018076f5068292d6ebdc914e77c to your computer and use it in GitHub Desktop.

Revisions

  1. T1ckbase revised this gist Aug 22, 2025. 2 changed files with 11 additions and 26 deletions.
    26 changes: 0 additions & 26 deletions anti-bot-detection.js
    Original file line number Diff line number Diff line change
    @@ -1,26 +0,0 @@
    // https://bot.sannysoft.com
    // https://www.browserscan.net/bot-detection
    // https://fingerprintjs.github.io/BotD/main/


    // Webdriver
    const defaultGetter = Object.getOwnPropertyDescriptor(Navigator.prototype, 'webdriver').get;
    // defaultGetter.apply(navigator); // true
    // defaultGetter.toString(); // 'function get webdriver() { [native code] }'
    Object.defineProperty(Navigator.prototype, 'webdriver', {
    set: undefined,
    enumerable: true,
    configurable: true,
    get: new Proxy(defaultGetter, { apply: (target, thisArg, args) => {
    // emulate getter call validation
    Reflect.apply(target, thisArg, args);
    return false;
    }})
    });
    // const patchedGetter = Object.getOwnPropertyDescriptor(Navigator.prototype, 'webdriver').get;
    // patchedGetter.apply(navigator); // false
    // patchedGetter.toString(); // 'function () { [native code] }'


    // CDP
    console.debug = () => {};
    11 changes: 11 additions & 0 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    import { chromium, devices } from 'playwright-core';

    const browser = await chromium.launch({
    headless: false,
    args: ['--disable-blink-features=AutomationControlled'],
    // @ts-ignore
    assistantMode: true,
    });
    const context = await browser.newContext({
    ...devices['Desktop Chrome'],
    });
  2. T1ckbase created this gist Mar 26, 2025.
    26 changes: 26 additions & 0 deletions anti-bot-detection.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    // https://bot.sannysoft.com
    // https://www.browserscan.net/bot-detection
    // https://fingerprintjs.github.io/BotD/main/


    // Webdriver
    const defaultGetter = Object.getOwnPropertyDescriptor(Navigator.prototype, 'webdriver').get;
    // defaultGetter.apply(navigator); // true
    // defaultGetter.toString(); // 'function get webdriver() { [native code] }'
    Object.defineProperty(Navigator.prototype, 'webdriver', {
    set: undefined,
    enumerable: true,
    configurable: true,
    get: new Proxy(defaultGetter, { apply: (target, thisArg, args) => {
    // emulate getter call validation
    Reflect.apply(target, thisArg, args);
    return false;
    }})
    });
    // const patchedGetter = Object.getOwnPropertyDescriptor(Navigator.prototype, 'webdriver').get;
    // patchedGetter.apply(navigator); // false
    // patchedGetter.toString(); // 'function () { [native code] }'


    // CDP
    console.debug = () => {};