Compare commits

...

11 Commits

Author SHA1 Message Date
ngosang
c99101f74b Bump version 2.2.9 2022-09-25 00:58:55 +02:00
ngosang
5703caa9d3 Commit the complete changelog 2022-09-25 00:57:31 +02:00
ngosang
aa254eb830 Detect Cloudflare Access Denied 2022-09-25 00:35:39 +02:00
ngosang
436831edb8 Bump version 2.2.8 2022-09-17 23:55:36 +02:00
ngosang
b17a3a369b Remove 30 s delay and clean legacy code 2022-09-17 23:48:39 +02:00
ilike2burnthing
a74884d0c1 Bump version 2.2.7 2022-09-12 01:47:08 +01:00
ilike2burnthing
0e2452e40e temp fix: add 30s delay
credit: @realivanjx
https://github.com/FlareSolverr/FlareSolverr/issues/481#issuecomment-1242951929
2022-09-12 01:44:01 +01:00
Diego Heras
ce52321b78 Update README.md 2022-08-21 09:09:30 +02:00
Diego Heras
4e07ed0f6c Update README.md 2022-08-21 09:05:02 +02:00
ngosang
9d607dcc8c Bump version 2.2.6 2022-07-31 16:13:32 +02:00
ngosang
a2345affb3 Fix Cloudflare detection in POST requests 2022-07-31 16:06:28 +02:00
7 changed files with 264 additions and 75 deletions

230
CHANGELOG.md Normal file
View File

@@ -0,0 +1,230 @@
# Changelog
## v2.2.9 (2022/09/25)
* Detect Cloudflare Access Denied
* Commit the complete changelog
## v2.2.8 (2022/09/17)
* Remove 30 s delay and clean legacy code
## v2.2.7 (2022/09/12)
* Temporary fix: add 30s delay
* Update README.md
## v2.2.6 (2022/07/31)
* Fix Cloudflare detection in POST requests
## v2.2.5 (2022/07/30)
* Update GitHub actions to build executables with NodeJs 16
* Update Cloudflare selectors and add HTML samples
* Install Firefox 94 instead of the latest Nightly
* Update dependencies
* Upgrade Puppeteer (#396)
## v2.2.4 (2022/04/17)
* Detect DDoS-Guard challenge
## v2.2.3 (2022/04/16)
* Fix 2000 ms navigation timeout
* Update README.md (libseccomp2 package in Debian)
* Update README.md (clarify proxy parameter) (#307)
* Update NPM dependencies
* Disable Cloudflare ban detection
## v2.2.2 (2022/03/19)
* Fix ban detection. Resolves #330 (#336)
## v2.2.1 (2022/02/06)
* Fix max timeout error in some pages
* Avoid crashing in NodeJS 17 due to Unhandled promise rejection
* Improve proxy validation and debug traces
* Remove @types/puppeteer dependency
## v2.2.0 (2022/01/31)
* Increase default BROWSER_TIMEOUT=40000 (40 seconds)
* Fix Puppeter deprecation warnings
* Update base Docker image Alpine 3.15 / NodeJS 16
* Build precompiled binaries with NodeJS 16
* Update Puppeter and other dependencies
* Add support for Custom CloudFlare challenge
* Add support for DDoS-GUARD challenge
## v2.1.0 (2021/12/12)
* Add aarch64 to user agents to be replaced (#248)
* Fix SOCKSv4 and SOCKSv5 proxy. resolves #214 #220
* Remove redundant JSON key (postData) (#242)
* Make test URL configurable with TEST_URL env var. resolves #240
* Bypass new Cloudflare protection
* Update donation links
## v2.0.2 (2021/10/31)
* Fix SOCKS5 proxy. Resolves #214
* Replace Firefox ERS with a newer version
* Catch startup exceptions and give some advices
* Add env var BROWSER_TIMEOUT for slow systems
* Fix NPM warning in Docker images
## v2.0.1 (2021/10/24)
* Check user home dir before testing web browser installation
## v2.0.0 (2021/10/20)
FlareSolverr 2.0.0 is out with some important changes:
* It is capable of solving the automatic challenges of Cloudflare. CAPTCHAs (hCaptcha) cannot be resolved and the old solvers have been removed.
* The Chrome browser has been replaced by Firefox. This has caused some functionality to be removed. Parameters: `userAgent`, `headers`, `rawHtml` and `downloadare` no longer available.
* Included `proxy` support without user/password credentials. If you are writing your own integration with FlareSolverr, make sure your client uses the same User-Agent header and Proxy that FlareSolverr uses. Those values together with the Cookie are checked and detected by Cloudflare.
* FlareSolverr has been rewritten from scratch. From now on it should be easier to maintain and test.
* If you are using Jackett make sure you have version v0.18.1041 or higher. FlareSolverSharp v2.0.0 is out too.
Complete changelog:
* Bump version 2.0.0
* Set puppeteer timeout half of maxTimeout param. Resolves #180
* Add test for blocked IP
* Avoid reloading the page in case of error
* Improve Cloudflare detection
* Fix version
* Fix browser preferences and proxy
* Fix request.post method and clean error traces
* Use Firefox ESR for Docker images
* Improve Firefox start time and code clean up
* Improve bad request management and tests
* Build native packages with Firefox
* Update readme
* Improve Docker image and clean TODOs
* Add proxy support
* Implement request.post method for Firefox
* Code clean up, remove returnRawHtml, download, headers params
* Remove outdated chaptcha solvers
* Refactor the app to use Express server and Jest for tests
* Fix Cloudflare resolver for Linux ARM builds
* Fix Cloudflare resolver
* Replace Chrome web browser with Firefox
* Remove userAgent parameter since any modification is detected by CF
* Update dependencies
* Remove Puppeter steath plugin
## v1.2.9 (2021/08/01)
* Improve "Execution context was destroyed" error handling
* Implement returnRawHtml parameter. resolves #172 resolves #165
* Capture Docker stop signal. resolves #158
* Reduce Docker image size 20 MB
* Fix page reload after challenge is solved. resolves #162 resolves #143
* Avoid loading images/css/fonts to speed up page load
* Improve Cloudflare IP ban detection
* Fix vulnerabilities
## v1.2.8 (2021/06/01)
* Improve old JS challenge waiting. Resolves #129
## v1.2.7 (2021/06/01)
* Improvements in Cloudflare redirect detection. Resolves #140
* Fix installation instructions
## v1.2.6 (2021/05/30)
* Handle new Cloudflare challenge. Resolves #135 Resolves #134
* Provide reference Systemd unit file. Resolves #72
* Fix EACCES: permission denied, open '/tmp/flaresolverr.txt'. Resolves #120
* Configure timezone with TZ env var. Resolves #109
* Return the redirected URL in the response (#126)
* Show an error in hcaptcha-solver. Resolves #132
* Regenerate package-lock.json lockfileVersion 2
* Update issue template. Resolves #130
* Bump ws from 7.4.1 to 7.4.6 (#137)
* Bump hosted-git-info from 2.8.8 to 2.8.9 (#124)
* Bump lodash from 4.17.20 to 4.17.21 (#125)
## v1.2.5 (2021/04/05)
* Fix memory regression, close test browser
* Fix release-docker GitHub action
## v1.2.4 (2021/04/04)
* Include license in release zips. resolves #75
* Validate Chrome is working at startup
* Speedup Docker image build
* Add health check endpoint
* Update issue template
* Minor improvements in debug traces
* Validate environment variables at startup. resolves #101
* Add FlareSolverr logo. resolves #23
## v1.2.3 (2021/01/10)
* CI/CD: Generate release changelog from commits. resolves #34
* Update README.md
* Add donation links
* Simplify docker-compose.yml
* Allow to configure "none" captcha resolver
* Override docker-compose.yml variables via .env resolves #64 (#66)
## v1.2.2 (2021/01/09)
* Add documentation for precompiled binaries installation
* Add instructions to set environment variables in Windows
* Build Windows and Linux binaries. resolves #18
* Add release badge in the readme
* CI/CD: Generate release changelog from commits. resolves #34
* Add a notice about captcha solvers
* Add Chrome flag --disable-dev-shm-usage to fix crashes. resolves #45
* Fix Docker CLI documentation
* Add traces with captcha solver service. resolves #39
* Improve logic to detect Cloudflare captcha. resolves #48
* Move Cloudflare provider logic to his own class
* Simplify and document the "return only cookies" parameter
* Show message when debug log is enabled
* Update readme to add more clarifications. resolves #53 (#60)
* issue_template: typo fix (#52)
## v1.2.1 (2020/12/20)
* Change version to match release tag / 1.2.0 => v1.2.0
* CI/CD Publish release in GitHub repository. resolves #34
* Add welcome message in / endpoint
* Rewrite request timeout handling (maxTimeout) resolves #42
* Add http status for better logging
* Return an error when no selectors are found, #25
* Add issue template, fix #32
* Moving log.html right after loading the page and add one on reload, fix #30
* Update User-Agent to match chromium version, ref: #15 (#28)
* Update install from source code documentation
* Update readme to add Docker instructions (#20)
* Clean up readme (#19)
* Add docker-compose
* Change default log level to info
## v1.2.0 (2020/12/20)
* Fix User-Agent detected by CouldFlare (Docker ARM) resolves #15
* Include exception message in error response
* CI/CD: Rename GitHub Action build => publish
* Bump version
* Fix TypeScript compilation and bump minor version
* CI/CD: Bump minor version
* CI/CD: Configure GitHub Actions
* CI/CD: Configure GitHub Actions
* CI/CD: Bump minor version
* CI/CD: Configure Build GitHub Action
* CI/CD: Configure AutoTag GitHub Action (#14)
* CI/CD: Build the Docker images with GitHub Actions (#13)
* Update dependencies
* Backport changes from Cloudproxy (#11)

View File

@@ -4,9 +4,9 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/flaresolverr/flaresolverr)](https://hub.docker.com/r/flaresolverr/flaresolverr/)
[![GitHub issues](https://img.shields.io/github/issues/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/FlareSolverr/FlareSolverr)](https://github.com/FlareSolverr/FlareSolverr/pulls)
[![Donate PayPal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X5NJLLX5GLTV6&source=url)
[![Donate Bitcoin](https://en.cryptobadges.io/badge/micro/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)](https://en.cryptobadges.io/donate/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
[![Donate Ethereum](https://en.cryptobadges.io/badge/micro/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)](https://en.cryptobadges.io/donate/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
[![Donate PayPal](https://img.shields.io/badge/Donate-PayPal-yellow.svg)](https://www.paypal.com/paypalme/diegoheras0xff)
[![Donate Bitcoin](https://img.shields.io/badge/Donate-Bitcoin-f7931a.svg)](https://www.blockchain.com/btc/address/13Hcv77AdnFWEUZ9qUpoPBttQsUT7q9TTh)
[![Donate Ethereum](https://img.shields.io/badge/Donate-Ethereum-8c8c8c.svg)](https://www.blockchain.com/eth/address/0x0D1549BbB00926BF3D92c1A8A58695e982f1BE2E)
FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flaresolverr",
"version": "2.2.5",
"version": "2.2.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "flaresolverr",
"version": "2.2.4",
"version": "2.2.9",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "flaresolverr",
"version": "2.2.5",
"version": "2.2.9",
"description": "Proxy server to bypass Cloudflare protection.",
"scripts": {
"install": "node install.js",

View File

@@ -6,7 +6,9 @@ import log from "../services/log";
* This class contains the logic to solve protections provided by CloudFlare
**/
const BAN_SELECTORS: string[] = [];
const BAN_SELECTORS: string[] = [
'div.main-wrapper div.header.section h1 span.code-label span' // CloudFlare
];
const CHALLENGE_SELECTORS: string[] = [
// todo: deprecate '#trk_jschal_js', '#cf-please-wait'
'#cf-challenge-running', '#trk_jschal_js', '#cf-please-wait', // CloudFlare
@@ -70,32 +72,6 @@ export default async function resolveChallenge(url: string, page: Page, response
// captcha detected
break
}
// new Cloudflare Challenge #cf-please-wait
const displayStyle = await page.evaluate((selector) => {
return getComputedStyle(document.querySelector(selector)).getPropertyValue("display");
}, selector);
if (displayStyle == "none") {
// spinner is hidden, could be a captcha or not
log.debug('Challenge element is hidden')
// wait until redirecting disappears
while (true) {
try {
await page.waitForTimeout(1000)
const displayStyle2 = await page.evaluate(() => {
return getComputedStyle(document.querySelector('#cf-spinner-redirecting')).getPropertyValue("display");
});
if (displayStyle2 == "none") {
break // hCaptcha detected
}
} catch (error) {
break // redirection completed
}
}
break
} else {
log.debug('Challenge element is visible')
}
}
log.debug('Found challenge element again')

View File

@@ -90,7 +90,7 @@ async function resolveChallenge(params: V1Request, session: SessionsCacheItem):
// reload the page to be sure we get the real page
log.debug("Reloading the page")
try {
response = await gotoPage(params, page);
response = await gotoPage(params, page, params.method);
} catch (e) {
log.warn("Page not reloaded (do not report!): Cause: " + e.toString())
}
@@ -132,9 +132,10 @@ async function resolveChallenge(params: V1Request, session: SessionsCacheItem):
}
}
async function gotoPage(params: V1Request, page: Page): Promise<HTTPResponse> {
async function gotoPage(params: V1Request, page: Page, method: string = 'GET'): Promise<HTTPResponse> {
let pageTimeout = params.maxTimeout / 3;
let response: HTTPResponse
try {
response = await page.goto(params.url, {waitUntil: 'domcontentloaded', timeout: pageTimeout});
} catch (e) {
@@ -142,47 +143,29 @@ async function gotoPage(params: V1Request, page: Page): Promise<HTTPResponse> {
response = await page.goto(params.url, {waitUntil: 'domcontentloaded', timeout: pageTimeout});
}
if (params.method == 'POST') {
// post hack
await page.setContent(
`
if (method == 'POST') {
// post hack, it only works with utf-8 encoding
let postForm = `<form id="hackForm" action="${params.url}" method="POST">`;
let queryString = params.postData;
let pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
for (let i = 0; i < pairs.length; i++) {
let pair = pairs[i].split('=');
let name; try { name = decodeURIComponent(pair[0]) } catch { name = pair[0] }
if (name == 'submit') continue;
let value; try { value = decodeURIComponent(pair[1] || '') } catch { value = pair[1] || '' }
postForm += `<input type="text" name="${name}" value="${value}"><br>`;
}
postForm += `</form>`;
await page.setContent(`
<!DOCTYPE html>
<html>
<body>
<script>
function parseQuery(queryString) {
var query = {};
var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&');
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split('=');
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
}
return query;
}
const form = document.createElement('form');
form.method = 'POST';
form.action = '${params.url}';
const params = parseQuery('${params.postData}');
for (const key in params) {
if (params.hasOwnProperty(key)) {
const hiddenField = document.createElement('input');
hiddenField.type = 'hidden';
hiddenField.name = key;
hiddenField.value = params[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
</script>
${postForm}
<script>document.getElementById('hackForm').submit();</script>
</body>
</html>
`
</html>`
);
await page.waitForTimeout(2000)
try {

View File

@@ -14,7 +14,7 @@ const googleUrl = "https://www.google.com";
const postUrl = "https://ptsv2.com/t/qv4j3-1634496523";
const cfUrl = "https://nowsecure.nl";
const cfCaptchaUrl = "https://idope.se"
const cfBlockedUrl = "https://www.torrentmafya.org/table.php"
const cfBlockedUrl = "https://avistaz.to/api/v1/jackett/torrents?in=1&type=0&search="
const ddgUrl = "https://anidex.info/";
const ccfUrl = "https://www.muziekfabriek.org";