DevTools Anti-Detector

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

As of 2018-04-27. See the latest version.

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

(function() {
    'use strict';
    let tS = Object.getOwnPropertyDescriptor(RegExp.prototype, 'toString');
    let fts = Function.prototype.toString;
    Object.defineProperty(RegExp.prototype, 'toString', {
        enumerable: tS.enumerable,
        configurable: tS.configurable,
        get: () => this ? (this._actual_toString ? this._actual_toString : tS.value) : tS.value,
        set: function(val) {
            if (fts.call(val) === 'function toString() { [native code] }') {
                this._actual_toString = val;
                return true;
            }
            console.log('Attempt to change toString for', this, 'with', fts.call(val));
            return true;
        }
    });
})();