Ulyssedev / Rust-undetected-chromedriver

A rust implementation of ultrafunkamsterdam's undetected-chromedriver library based on thirtyfour
https://crates.io/crates/undetected-chromedriver
MIT License
33 stars 20 forks source link

not passing Coudflare Turnstile #4

Open chungwong opened 9 months ago

chungwong commented 9 months ago

It is detected with chrome 116.0.5845.110 It looks like https://github.com/ultrafunkamsterdam is having the same issue too.

use undetected_chromedriver::chrome;
use tokio;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let driver = chrome().await?;

    driver.goto("https://nowsecure.nl/").await?;

    let title = driver.title().await?;
    println!("Title: {}", title);

    // driver.quit().await?;

    Ok(())
}
Ulyssedev commented 9 months ago

Hey, thanks for submitting an issue. It does look like the newer Chrome versions are indeed being detected sometimes. I did some quick experiments, and it seems like when going to the site through a new tab, it passes without any issues. I have no idea why thought. I will do some further investigations and come up with a fix soon.

chungwong commented 9 months ago

I confirm the behaviour on manually opening a new tab, however, if the new tab is part of the automation, it will still fail.

use undetected_chromedriver::chrome;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let driver = chrome().await?;

    driver.goto("https://google.com/").await?;
    let handle = driver.new_tab().await?;
    driver.switch_to_window(handle).await?;
    tokio::time::sleep(std::time::Duration::from_secs(1));
    driver.goto("https://nowsecure.nl/").await?;

    tokio::time::sleep(std::time::Duration::from_secs(100));

    Ok(())
}
itehax commented 8 months ago

I confirm the behaviour on manually opening a new tab, however, if the new tab is part of the automation, it will still fail.


use undetected_chromedriver::chrome;

#[tokio::main]

async fn main() -> Result<(), Box<dyn std::error::Error>> {

    let driver = chrome().await?;

    driver.goto("https://google.com/").await?;

    let handle = driver.new_tab().await?;

    driver.switch_to_window(handle).await?;

    tokio::time::sleep(std::time::Duration::from_secs(1));

    driver.goto("https://nowsecure.nl/").await?;

    tokio::time::sleep(std::time::Duration::from_secs(100));

    Ok(())

}

yes,you have to perform specific steps to bypass cloudflare. I will be releasing a video on my channel shortly showing how to bypass it using rust and this crate :)

itehax commented 8 months ago

https://github.com/itehax/rust-scraping

you can find a way to bypass cloudflare using this library in this project.

Ulyssedev commented 8 months ago

The latest commit has made it possible to bypass cloudflare, code improvements are still needed and further testing must be done until it can be released properly. This is still a work in progress and will introduce some breaking changes. This would have not been possible without the work of @itehax, so thanks a lot!

cchance27 commented 3 months ago

Silly question, but how does this differ from what the guys over at https://github.com/kaliiiiiiiiii/Selenium-Driverless are doing, according to what i've read they managed to get around the more recent detections?

kaliiiiiiiiii commented 2 months ago

Silly question, but how does this differ from what the guys over at https://github.com/kaliiiiiiiiii/Selenium-Driverless are doing, according to what i've read they managed to get around the more recent detections?

Thee key here is Runtime.enable detection. Also see https://github.com/kaliiiiiiiiii/Selenium-Driverless/discussions/86#discussion-5717720 and https://github.com/HMaker/HMaker.github.io/tree/master/selenium-detector

Ulyssedev commented 2 months ago

I guess I would have to rewrite the library without thirtyfour to create something similar to https://github.com/ultrafunkamsterdam/nodriver

kaliiiiiiiiii commented 2 months ago

I guess I would have to rewrite the library without thirtyfour to create something similar to https://github.com/ultrafunkamsterdam/nodriver

basically, you've got to use the CDP protocol directly. Lot of work I can tell - from experience at driverless :/