Skip to content

Instantly share code, notes, and snippets.

@wagyourtail
Last active June 1, 2024 08:49
Show Gist options
  • Save wagyourtail/1026f70df0db3abbe950a126899fa599 to your computer and use it in GitHub Desktop.
Save wagyourtail/1026f70df0db3abbe950a126899fa599 to your computer and use it in GitHub Desktop.
bypass disable-devtool
// ==UserScript==
// @name Bypass Detect-Devtool
// @namespace http://tampermonkey.net/
// @version 0.1
// @description bypass https://github.com/theajack/disable-devtool
// @author Wagyourtail
// @match {site}
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.io
// @grant none
// ==/UserScript==
// change this to be at document-start,
// for best results, open devtools after page load
(function() {
'use strict';
const ua = navigator.userAgent.toLowerCase();
const has = (name) => ua.indexOf(name) !== -1;
const iframe = !!window.top && window !== window.top;
const pc = !/(iphone|ipad|ipod|ios|android)/i.test(ua);
const qqBrowser = has('qqbrowser');
const firefox = has('firefox');
const macos = has('macintosh');
const edge = has('edge');
const oldEdge = edge && !has('chrome');
const ie = oldEdge || has('trident') || has('msie');
const chrome = has('chrome');
function bypass() {
// Type = 0 Reg2String
if (qqBrowser || firefox) {
const log = console.log
console.log = (...a) => {
log(...a.map(e => {
if (e instanceof RegExp) {
return new RegExp(e.source, e.flags)
} else {
return e
}
}))
}
}
// type = 2 Window Size
window.devicePixelRatio = false
if (chrome) {
window.screen = null
}
// type = 6 Performance
if (chrome) {
function wait(ms) {
var start = Date.now(),
now = start
while (now - start < ms) {
now = Date.now()
}
}
const log = console.log;
console.log = (...a) => {
wait(20)
log(...a)
}
}
}
bypass()
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment