go-rod / stealth

anti-bot-detection with rod
https://pkg.go.dev/github.com/go-rod/stealth
MIT License
234 stars 29 forks source link

I guess stealth.min.js is detectable using the Default Device, wondering if we could change webgl, etc, through the API #20

Open NuLL3rr0r opened 2 years ago

NuLL3rr0r commented 2 years ago

When I visit https://amiunique.org/fp and https://coveryourtracks.eff.org/ using:

    page := stealth.MustPage(browser)
    page.MustEmulate(devices.Device{
        Title: "Custom Linux Desktop",
        UserAgent:      "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0)",
        AcceptLanguage: "en",
    })
    page.MustNavigate("https://amiunique.org/fp")

AmIUnique always shows Intel Iris as a graphics card and EFF says my browser's fingerprint is unique and detectable. If I visit using my regular desktop Brave browser it says: your browser has a randomized fingerprint. So, is there any way to customize those through go-rod/stealth?

It seems there might be ways to change or randomize those using JavaScript here and here for example. But, I couldn't find a way in the API to allow me to do that.

So relevant issue on berstend/puppeteer-extra that might explain the issue better.

In a regular browser either Firefox or Chrome if you look for Fingerprint extensions there are some extensions that do a good job at randomizing the Fingerprint. They even notify you when an attempt is made by the website you are visiting Fingerprint you. If we could load these extensions, using rod they might be able to do the job. Sadly, it seems load-extension not working in my Firefox tests, haven't tested with chrome yet. But, I remember chromedp had no way to do that. Especially if I load an existing user data-dir. If I recall correctly, I saw some comments in the rod doc that NewUserMode might not be usable in such scenarios as well.

I appreciate it if you head me in the right direction. Thank you!

ysmood commented 2 years ago

You can eval any js you like with rod, if it works for you, you can share your solution with a PR to this project, I think that will help a lot of developers.

Rod supports exntensions, check the example

https://github.com/go-rod/rod/blob/9aab67b659ecdf50d17152ca0eb7a547c5f4aa1c/examples_test.go#L570-L590

NuLL3rr0r commented 2 years ago

Thank you very much! Will check them out and let you know once I made them work.