seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
5.36k stars 980 forks source link

SB with Stealth not pass iphey.com , pixelscan.net #2406

Closed pythondeveloperz closed 10 months ago

pythondeveloperz commented 10 months ago

hello please i try to use SB with seleniumstealth but not pass iphey.com , pixelscan.net

this is my code 👍


> from seleniumbase import Driver
> from selenium_stealth import stealth
> 
> driver = Driver(uc=True,mobile=True)
> 
> stealth(
>     driver,
>     languages=["en-US", "en"],
>     vendor="Google Inc.",
>     platform="Android",
>     webgl_vendor="Google Inc. (Imagination Technologies)",
>     renderer="ANGLE (Imagination Technologies,PowerVR Rogue GE8320, OpenGL ES 3.2)",
>     fix_hairline=True,
> )
> driver.get("https://iphey.com")
> 
> 
> #driver.get("https://browserleaks.com/webrtc")
> driver.sleep(10000)
> driver.quit()
mdmintz commented 10 months ago

For starters, you can't combine SB mobile mode with selenium-stealth because selenium-stealth overrides mobile mode settings. For bypassing automation detection, choose between:

If your goal is to pass the unmasked-fingerprint test and the no-automation-framework-detected test, then use:

from seleniumbase import Driver

driver = Driver(uc=True)
driver.uc_open_with_reconnect("https://pixelscan.net", "breakpoint")
driver.quit()
Screenshot 2024-01-02 at 10 32 53 AM

Combining selenium-stealth with UC Mode will make it such that they still can't detect that you're using an automation framework, but they may still be able to see that you're masking your fingerprint.

If you use selenium-stealth with UC Mode, you can still bypass Cloudflare:

from seleniumbase import Driver
from selenium_stealth import stealth

driver = Driver(uc=True)
stealth(
    driver,
    languages=["en-US", "en"],
    vendor="Google Inc.",
    platform="Android",
    webgl_vendor="Google Inc. (Imagination Technologies)",
    renderer="ANGLE (Imagination Technologies,PowerVR Rogue GE8320, OpenGL ES 3.2)",
    fix_hairline=True,
)
driver.uc_open_with_reconnect("https://nowsecure.nl/#relax", "breakpoint")
driver.quit()

Or you can use UC Mode with Mobile Mode:

(Use with driver.get() instead of driver.uc_open_with_reconnect())

from seleniumbase import Driver

driver = Driver(uc=True, mobile=True)
driver.get("https://nowsecure.nl/#relax")
driver.sleep(6)
driver.quit()
Screenshot 2024-01-02 at 10 50 58 AM

But if you just need to get past the Turnstile, here's the simplest, most reliable way:

from seleniumbase import Driver

driver = Driver(uc=True)
driver.uc_open_with_reconnect("https://nowsecure.nl/#relax", "breakpoint")
driver.quit()
Screenshot 2024-01-02 at 10 59 07 AM
pythondeveloperz commented 10 months ago

> from seleniumbase import Driver
> 
> driver = Driver(uc=True,mobile=True)
> driver.get("https://pixelscan.net")
> input("any:")
> driver.quit()

when i use UC mode + Mobile it didnt pass as i use UC mode only i upload you screenshots appear the result

fingerprint masking antidetect browser

pythondeveloperz commented 10 months ago

`from selenium_profiles import webdriver from selenium_profiles.profiles import profiles

profile = profiles.Android()

driver = webdriver.Chrome(profile, uc_driver=True, seleniumwire_options=True) # or pass seleniumwire-options

checkout headers

driver.get("https://pixelscan.net") input("Press ENTER to quit..") driver.quit() exit()`

https://github.com/kaliiiiiiiiii/Selenium-Profiles

when i use this package for mobile emulation it passes the point of masking fingerprint is it possible to use this package with Seleniumbase instead of Seleniumwire ?

mdmintz commented 10 months ago

All that matters is: "No automation framework detected". That's the whole point of UC Mode: To appear human.

A website will know you're masking your fingerprint if you use mobile mode, but they still won't detect your automation framework because you also have UC Mode:

Screenshot 2024-01-02 at 11 49 11 PM

If your goal is to pass the unmasked-fingerprint test and the no-automation-framework-detected test, then use this:

from seleniumbase import Driver

driver = Driver(uc=True)
driver.uc_open_with_reconnect("https://pixelscan.net", "breakpoint")
driver.quit()
Screenshot 2024-01-02 at 10 32 53 AM

That means not using mobile mode. Just use regular UC Mode.

pythondeveloperz commented 10 months ago

`from selenium_profiles import webdriver from selenium_profiles.profiles import profiles profile = profiles.Android() driver = webdriver.Chrome(profile, uc_driver=True, seleniumwire_options=True) # or pass seleniumwire-options

checkout headers

driver.get("https://pixelscan.net") input("Press ENTER to quit..") driver.quit() exit()`

https://github.com/kaliiiiiiiiii/Selenium-Profiles

when i use this package for mobile emulation it passes the point of masking fingerprint is it possible to use this package with Seleniumbase instead of Seleniumwire ?

what about to combine this package with SB?

mdmintz commented 10 months ago

It sounds like you should ask the maintainer of selenium-profiles for combining their package with seleniumbase. It should be easy for them to do it if they swap out the selenium-wire driver with the seleniumbase driver.

Tongcheng commented 7 months ago

Running in colab, with UC=True, without mobile, also seems to have "pixelscan.net" saying "I'm masking the fingerprint". Does this mean pixelscan's hardware fingerprint can detect if you're in a docker (Colab is in docker)?

with SB(uc=True, xvfb=True, proxy="<proxy>") as sb:
    sb.driver.uc_open_with_reconnect("https://pixelscan.net", 30)
    sb.driver.save_screenshot("screenshot.png")
mdmintz commented 7 months ago

@Tongcheng Possibly due to Colab or Docker or the proxy used. Regular SeleniumBase UC Mode works fine on that page.

Tongcheng commented 7 months ago

Thanks @mdmintz for the reply! I actually started a fresh EC2/ubuntu image, installed SeleniumBase without docker, but it seems PixelScan reports hardware fingerprint masking detected:

image

Do you know if it's due to Linux?

mdmintz commented 7 months ago

@Tongcheng It thinks you're spoofing your location. SeleniumBase UC Mode doesn't change your location, so you might be doing something separately that's causing your issue, such as using a bad proxy.