HMaker / HMaker.github.io

55 stars 11 forks source link

How to bypass `Either Devtools Console is open or CDP Runtime Domain is enabled`? #2

Open leiless opened 10 months ago

leiless commented 10 months ago

https://github.com/HMaker/HMaker.github.io/blob/master/selenium-detector/chromedriver.js

        new CDPRuntimeDomainTest(
            'devtools-console',
            'Either Devtools Console is open or CDP Runtime Domain is enabled'
        )

/**
 * Detects CDP Runtime Domain enabled.
 * 
 * see https://source.chromium.org/chromium/chromium/src/+/main:v8/src/inspector/v8-runtime-agent-impl.cc;l=992
 */
class CDPRuntimeDomainTest extends SeleniumDetectionTest {

    test(window) {
        let stackLookup = false;
        const e = new window.Error();
        // there might be several ways to catch property access from console print functions
        window.Object.defineProperty(e, 'stack', {
            configurable: false,
            enumerable: false,
            get: function() {
                stackLookup = true;
                return '';
            }
        });
        // can be bypassed by patching all console print functions
        window.console.debug(e);
        return stackLookup;
    }

}

Hi, @HMaker. Just wonder how could we bypass the CDPRuntimeDomainTest?

// can be bypassed by patching all console print functions
window.console.debug(e);

Don't understand how to do this. Do you mean by commenting on all console.log() usages in the js code?