elcattivo / CloudFlareUtilities

A .NET Standard Library to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.
MIT License
190 stars 47 forks source link

HttpWebRequest instead of httpclient #26

Closed gmareater closed 6 years ago

gmareater commented 6 years ago

hi Thanx for your work,

Is there any way to use HttpWebRequest instead of httpclient? could you provide sample?

elcattivo commented 6 years ago

Sorry, but I'm not aware of a simple method to use this library together with HttpWebRequest. You basically have to manually do all the steps that happen inside the ClearanceHandler.

  1. Add a CookieContainer to your request
  2. Add a Client-Header to your request
  3. Get the response and check if the JS-challenge is present
  4. Solve the JS-challenge using the ChallengeSolver-class
  5. Build the clearance URL using the solution and request it
  6. Add the cookies provided by the clearance page to your original request
  7. Repeat your original request

This list is maybe not complete, but that is more or less, what the ClearanceHandler normally would to for you. At least you can make use of the ChallengeSolver.

gmareater commented 6 years ago

thanx for your tips, I willl give it a try :)

gmareater commented 6 years ago

hi It worked, i just make _cookie field ,"Public", and replace my own cookie container I'm so Happy :))

Thanx dude