/CloudflareBypass

Coroutines based Kotlin library which bypasses the Cloudflare IUAM page

Primary LanguageKotlinApache License 2.0Apache-2.0

Cloudflare Bypass


💠️A coroutine based kotlin library which bypasses the Cloudflare IUAM page.
Inspired by KyranRana/cloudflare-bypass


CircleCI License License

Features

  • HTTP GET/POST
  • Bypasses regular anti-bot page

Dependencies

  • OkHttp 4
  • Mozilla Rhino

Installation

Add jcenter repository

repositories {
    jcenter()
}

And add a dependency code

implementation 'me.marplex.cloudflarebypass:cloudflare-bypass:1.1'

Usage

Requesting a cloudflare-protected webpage.

runBlocking {
    val client = CloudflareHTTPClient()

    //Returns an OkHttp Response object
    val url = "https://www.example.com".toHttpUrlOrNull()!!
    val response = client.get(url)
}

Requesting a cloudflare-protected webpage with custom headers

runBlocking {
    val client = CloudflareHTTPClient()

    //Returns an OkHttp Response object
    val url = "https://www.example.com".toHttpUrlOrNull()!!
    val response = client.get(url) {
        addHeader("X-Custom", "1")
    }
}

Performing a post request to a cloudflare-protected webpage

runBlocking {
    val client = CloudflareHTTPClient()

    val formBody = FormBody.Builder()
        .add("testParams", "itWorks")
        .build()

    //Returns an OkHttp Response object
    val url = "https://www.example.com".toHttpUrlOrNull()!!
    val response = client.post(url, formBody)
}

Create a custom HTTP client

val client = CloudflareHTTPClient() {
    delay = 8000
    httpClient = {
        //cookieJar(...)
        //connectionSpecs(...)
    }
}

Todo

  • Implement every HTTP methods
  • Make this library more portable (Android)
  • Try to bypass captcha