Skip to content

Cloudflare-Bypass is an Android library that allows developers to seamlessly bypass Cloudflare's anti-bot protection using a custom WebViewClient. It enables websites protected by Cloudflare's challenge to load automatically without user intervention, offering easy integration with minimal setup.

License

Notifications You must be signed in to change notification settings

darkryh/Cloudflare-Bypass

Repository files navigation

CI CI CI

Cloudflare-Bypass

Note: For devices running Android API level 30 or lower, it is recommended to specify a custom userAgent in the WebView settings to prevent being blocked by outdated browser warnings.

Cloudflare-Bypass is an Android library designed to seamlessly bypass Cloudflare's anti-bot protection using a custom WebViewClient. This library allows developers to load websites protected by Cloudflare's challenge without needing manual user intervention.

Show-Case

Bypass Cloudflare

Features

  • Custom WebViewClient for Cloudflare bypass.
  • Automatic handling of Cloudflare's anti-bot checks.
  • Easy integration into any Android project with minimal setup.
  • Supports bypass for sites using Cloudflare protection.

Requirements

  • Minimum SDK: 21 (Android 5.0 Lollipop)
  • Compile SDK: 34
  • Target SDK: 34
  • Language: Kotlin

Getting Started

Add the JitPack repository to your root build.gradle at the end of the repositories section:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Installation - Gradle

dependencies {  
    implementation("com.github.darkryh:Cloudflare-Bypass:$version")
}

Example of Implementation

@Composable
fun ComposableWebView(modifier: Modifier = Modifier) {
    AndroidView(
        modifier = modifier.fillMaxSize(),
        factory = { context ->
            WebView(context).apply {
                webViewClient = BypassClient()
            }
        }
    )
}

Replacement options for override clients

Options available to the client. The other settings remain unchanged.

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            CloudFlareByPassTheme {
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
                    AndroidView(
                        modifier = Modifier
                            .padding(innerPadding)
                            .fillMaxSize(),
                        factory = { context ->
                            WebView(context).apply {
                                /**do configuration **/
                                
                                webViewClient = object : BypassClient() {
                                    override fun onPageStartedPassed(
                                        view: WebView?,
                                        url: String?,
                                        favicon: Bitmap?
                                    ) {
                                        println("onPageStartedPassed")
                                        super.onPageStartedPassed(view, url, favicon)
                                    }
                                    override fun onPageFinishedByPassed(view: WebView?, url: String?) {
                                        super.onPageFinishedByPassed(view, url)
                                        Toast.makeText(context, "Bypass", Toast.LENGTH_SHORT).show()
                                    }
                                }
                                
                                loadUrl("Your target site")
                            }
                        }
                    )
                }
            }
        }
    }
}

Want to collaborate

If you want to help or collaborate, feel free to contact me on X (Twitter) account @Darkryh or just make a pull request.

About

Cloudflare-Bypass is an Android library that allows developers to seamlessly bypass Cloudflare's anti-bot protection using a custom WebViewClient. It enables websites protected by Cloudflare's challenge to load automatically without user intervention, offering easy integration with minimal setup.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages