Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CDP Signal Detection to Anti Debug #138

Open
youdie323323 opened this issue Aug 21, 2024 · 3 comments
Open

Add CDP Signal Detection to Anti Debug #138

youdie323323 opened this issue Aug 21, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@youdie323323
Copy link

in Chrome, possible to detect when devtools is open by using the Runtime.enable event. for information, please read this article: How New Headless Chrome & the CDP Signal Are Impacting Bot Detection.

Here is a simple example that can detect if devtools is open (only chrome):

if (window.chrome) {
    let r = Math.random() * 1000 | 0;
    let r2 = Math.random() * 1000 | 0;
    let _r = r;

    try {
        let err = new Error();
        Object.defineProperty(err, "stack", {
            configurable: false,
            enumerable: false,
            get: function () {
                _r += r2;
                return "";
            }
        });

        // Dont remove this line
        console.debug(err);
        err.stack;

        if (r + r2 !== _r) {
            // Implement countermeasures here
            console.log("DevTools detected!");
        }
    } catch (e) { }
}

Test on chrome 127:

Desktop.2024.08.21.-.11.43.28.03.mp4
@youdie323323 youdie323323 added the enhancement New feature or request label Aug 21, 2024
@doctor8296
Copy link

There is a lot other methods to check for devtool:
https://github.com/AEPKILL/devtools-detector

@MichaelXF
Copy link
Owner

Great find, this can be added

@Mrgaton
Copy link

Mrgaton commented Oct 2, 2024

Great find, this can be added

you could add to run your custom script or function or to do a custom action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants