Skip to content

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

@leiless

Description

@leiless

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions