How do I override window.console.debug so that it behaves identically when the chrome dev tools is in use?

169 Views Asked by At

I've been using https://requestly.io/ to make a Javascript script execute before the code of an annoying website that is trying to hide information from me by detecting when chrome dev tools is opened and breaking itself. The website uses window.console.debug to accomplish it. I've tried tricking it like so:

window.console.debug = new Proxy(console.debug, {
  apply(target, thisArg, args) {
    // Return undefined for all inputs to mimic console being closed
    return function() { return undefined; };
  }
});

But it detects it and throws an error, I suspect it's because the inputs aren't quite right, given the window.console.debug function is a native code implementation does anyone have an idea how to make an overwritten one that behaves functionally identical? I've also tried this

window.console.debug = function(){
  window.chrome.debug= function() {
      return;
  }
} 

But it is also detected. Again I believe it's to do with the arguments or some other properties of the console.debug as shown here (https://developer.mozilla.org/en-US/docs/Web/API/Console/debug) but I'm unsure how to mimic this fully whilst still preventing its use in detecting an open chrome dev tools.

0

There are 0 best solutions below