Skip to content

is there any method to modify WebGL? #2048

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

Closed
YOTYTeaM opened this issue Sep 1, 2023 · 2 comments
Closed

is there any method to modify WebGL? #2048

YOTYTeaM opened this issue Sep 1, 2023 · 2 comments
Labels
question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@YOTYTeaM
Copy link

YOTYTeaM commented Sep 1, 2023

hello, is there any method to modify WebGL?

change WebGL renderer and vendor, and canvas, audio,..

a way to make new fingerprint..

Im using SB

@mdmintz mdmintz added question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels Sep 1, 2023
@mdmintz
Copy link
Member

mdmintz commented Sep 1, 2023

If there was a way to modify WebGL or other Chrome internals, it would be through driver.execute_cdp_cmd().

Here's an example of using that to change the Geo Location: https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_geolocation.py

self.execute_cdp_cmd(
            "Browser.grantPermissions",
            {
                "origin": "https://www.openstreetmap.org/",
                "permissions": ["geolocation"],
            },
        )
        self.execute_cdp_cmd(
            "Emulation.setGeolocationOverride",
            {
                "latitude": 48.87645,
                "longitude": 2.26340,
                "accuracy": 100,
            },
        )

For more info on driver.execute_cdp_cmd(), you may have to search the web.

@mdmintz mdmintz closed this as completed Sep 1, 2023
@YOTYTeaM
Copy link
Author

YOTYTeaM commented Sep 1, 2023

thank you,
https://github.com/diprajpatra/selenium-stealth it works but made driver detectable
also i made extension to change it, it works but again made it detectable.

js extension code:

function modifyWebGLParameters() {
  const getParameter = WebGLRenderingContext.prototype.getParameter;
  WebGLRenderingContext.prototype.getParameter = function(parameter) {
    if (parameter === 37445) {
      return "Google Inc.";
    }
    if (parameter === 37446) {
      return "ANGLE (Intel HD Graphics 620 Direct3D11 vs50 ps50) ";
    }
    return getParameter.apply(this, arguments);
  };
}

function injectScript(fn) {
  const script = document.createElement('script');
  script.text = `(${fn.toString()})();`;
  document.documentElement.appendChild(script);
  script.parentNode.removeChild(script);
}

injectScript(modifyWebGLParameters);

https://pixelscan.net/ says that you are masking your fingerprint

@seleniumbase seleniumbase locked as resolved and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Someone is looking for answers UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants