Git Product home page Git Product logo

cloudflareutilities's Introduction

CloudFlare Utilities

NuGet Pre Release AppVeyor Codecov GitHub license

A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.

Features

  • No dependencies (e.g. no external JavaScript interpreter required)
  • Easily integrated into your project (implemented as DelegatingHandler; e.g. can be used with HttpClient)
  • Usable on many different platforms (PCL Profile 111)

Usage

try
{
    // Create the clearance handler.
    var handler = new ClearanceHandler
    {
        MaxRetries = 2 // Optionally specify the number of retries, if clearance fails (default is 3).
    };

    // Create a HttpClient that uses the handler to bypass CloudFlare's JavaScript challange.
    var client = new HttpClient(handler);

    // Use the HttpClient as usual. Any JS challenge will be solved automatically for you.
    var content = await client.GetStringAsync("http://protected-site.tld/");
}
catch (AggregateException ex) when (ex.InnerException is CloudFlareClearanceException)
{
    // After all retries, clearance still failed.
}
catch (AggregateException ex) when (ex.InnerException is TaskCanceledException)
{
    // Looks like we ran into a timeout. Too many clearance attempts?
    // Maybe you should increase client.Timeout as each attempt will take about five seconds.
}

cloudflareutilities's People

Contributors

elcattivo avatar pyguy2 avatar zone117x avatar

Watchers

 avatar  avatar

Forkers

sireof

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.