mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-07 12:05:37 +00:00
Detect DDoS-Guard challenge
This commit is contained in:
parent
93d8350097
commit
d962e1a14e
@ -8,11 +8,11 @@
|
|||||||
[](https://en.cryptobadges.io/donate/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
|
[](https://en.cryptobadges.io/donate/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
|
||||||
[](https://en.cryptobadges.io/donate/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
|
[](https://en.cryptobadges.io/donate/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
|
||||||
|
|
||||||
FlareSolverr is a proxy server to bypass Cloudflare protection.
|
FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
FlareSolverr starts a proxy server and it waits for user requests in an idle state using few resources.
|
FlareSolverr starts a proxy server, and it waits for user requests in an idle state using few resources.
|
||||||
When some request arrives, it uses [puppeteer](https://github.com/puppeteer/puppeteer) with the
|
When some request arrives, it uses [puppeteer](https://github.com/puppeteer/puppeteer) with the
|
||||||
[stealth plugin](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth)
|
[stealth plugin](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth)
|
||||||
to create a headless browser (Firefox). It opens the URL with user parameters and waits until the Cloudflare challenge
|
to create a headless browser (Firefox). It opens the URL with user parameters and waits until the Cloudflare challenge
|
||||||
|
@ -21,7 +21,8 @@ const CAPTCHA_SELECTORS: string[] = [
|
|||||||
export default async function resolveChallenge(url: string, page: Page, response: HTTPResponse): Promise<HTTPResponse> {
|
export default async function resolveChallenge(url: string, page: Page, response: HTTPResponse): Promise<HTTPResponse> {
|
||||||
|
|
||||||
// look for challenge and return fast if not detected
|
// look for challenge and return fast if not detected
|
||||||
let cfDetected = response.headers().server && response.headers().server.startsWith('cloudflare');
|
let cfDetected = response.headers().server &&
|
||||||
|
(response.headers().server.startsWith('cloudflare') || response.headers().server.startsWith('ddos-guard'));
|
||||||
if (cfDetected) {
|
if (cfDetected) {
|
||||||
if (response.status() == 403 || response.status() == 503) {
|
if (response.status() == 403 || response.status() == 503) {
|
||||||
cfDetected = true; // Defected CloudFlare and DDoS-GUARD
|
cfDetected = true; // Defected CloudFlare and DDoS-GUARD
|
||||||
|
@ -15,7 +15,7 @@ const postUrl = "https://ptsv2.com/t/qv4j3-1634496523";
|
|||||||
const cfUrl = "https://pirateiro.com/torrents/?search=harry";
|
const cfUrl = "https://pirateiro.com/torrents/?search=harry";
|
||||||
const cfCaptchaUrl = "https://idope.se"
|
const cfCaptchaUrl = "https://idope.se"
|
||||||
const cfBlockedUrl = "https://www.torrentmafya.org/table.php"
|
const cfBlockedUrl = "https://www.torrentmafya.org/table.php"
|
||||||
const ddgUrl = "https://www.erai-raws.info/feed/?type=magnet";
|
const ddgUrl = "https://anidex.info/";
|
||||||
const ccfUrl = "https://www.muziekfabriek.org";
|
const ccfUrl = "https://www.muziekfabriek.org";
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -189,12 +189,12 @@ describe("Test '/v1' path", () => {
|
|||||||
expect(solution.url).toContain(ddgUrl)
|
expect(solution.url).toContain(ddgUrl)
|
||||||
expect(solution.status).toBe(200);
|
expect(solution.status).toBe(200);
|
||||||
expect(Object.keys(solution.headers).length).toBeGreaterThan(0)
|
expect(Object.keys(solution.headers).length).toBeGreaterThan(0)
|
||||||
expect(solution.response).toContain("<rss version")
|
expect(solution.response).toContain("<!DOCTYPE html>")
|
||||||
expect(Object.keys(solution.cookies).length).toBeGreaterThan(0)
|
expect(Object.keys(solution.cookies).length).toBeGreaterThan(0)
|
||||||
expect(solution.userAgent).toContain("Firefox/")
|
expect(solution.userAgent).toContain("Firefox/")
|
||||||
|
|
||||||
const cfCookie: string = (solution.cookies as any[]).filter(function(cookie) {
|
const cfCookie: string = (solution.cookies as any[]).filter(function(cookie) {
|
||||||
return cookie.name == "__ddg1";
|
return cookie.name == "__ddg1_";
|
||||||
})[0].value
|
})[0].value
|
||||||
expect(cfCookie.length).toBeGreaterThan(10)
|
expect(cfCookie.length).toBeGreaterThan(10)
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user