DevTools Anti-Detector

Simple tool to temporarily prevent site from using popular methods of DevTools detection. Do not leave enabled!

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         DevTools Anti-Detector
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Simple tool to temporarily prevent site from using popular methods of DevTools detection. Do not leave enabled!
// @author       lainverse
// @match        *://*/*
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    let knownRoots = new WeakSet();
    function wrapRegExp(root) {
        if (knownRoots.has(root))
            return;
        let _proto = void 0;
        try {
            _proto = root.RegExp.prototype;
        } catch(ignore) {
            return;
        }
        // Prevent RegExpt + toString trick (technically possible with any other object, but I encountered only this one
        let _RE_tS = Object.getOwnPropertyDescriptor(_proto, 'toString');
        let _RE_tSV = _RE_tS.value || _RE_tS.get();
        let fts = Function.prototype.toString;
        Object.defineProperty(_proto, 'toString', {
            enumerable: _RE_tS.enumerable,
            configurable: _RE_tS.configurable,
            get: () => _RE_tSV,
            set: function(val) {
                console.warn('Attempt to change toString for', this, 'with', fts.call(val));
                //throw 'stop it!';
                return true;
            }
        });
    }

    wrapRegExp(unsafeWindow);

    let _contentWindow = Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype, 'contentWindow');
    let _get_contentWindow = _contentWindow.get;
    _contentWindow.get = function() {
        let _cw = _get_contentWindow.apply(this, arguments);
        if (_cw)
            wrapRegExp(_cw);
        return _cw;
    };
    Object.defineProperty(HTMLIFrameElement.prototype, 'contentWindow', _contentWindow);
})();