Skip to content

Commit

Permalink
HeaderGenerator: restrict to more recent browser versions (#5938)
Browse files Browse the repository at this point in the history
Some website gives "browser too old" errors because of Cloudflare.

Somehow, depending on the protection level, we can mitigate those issues by generating a good user agent with more recent Chrome/Firefox versions.

This PR only makes sure we generate user-agents with browser major versions >= 100 for Chrome and Firefox, and =< 113 or 114 (Current major version for FF / Chrome)

This is more fingertprintable because there are less combinations :/
  • Loading branch information
MikeZeDev authored Jun 24, 2023
1 parent 44726f3 commit 839af54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/web/mjs/engine/HeaderGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export default class HeaderGenerator {

static get _browserChrome() {
let $ = HeaderGenerator;
let version = $._rn( 50, 66 ) + '.' + $._rn( 0, 99 ) + '.' + $._rn( 0, 9999 ) + '.' + $._rn( 0, 999 );
let version = $._rn( 105, 113 ) + '.' + $._rn( 0, 99 ) + '.' + $._rn( 0, 9999 ) + '.' + $._rn( 0, 999 );
return 'Mozilla/5.0 (' + $._os + ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' + version + ' Safari/537.36';
}

static get _browserFirefox() {
let $ = HeaderGenerator;
let version = $._rn( 45, 60 );
let version = $._rn( 105, 114 );
return 'Mozilla/5.0 (' + $._os + '; rv:' + version + '.0) Gecko/20100101 Firefox/' + version + '.0';
}

Expand Down Expand Up @@ -88,4 +88,4 @@ export default class HeaderGenerator {
*/
return $._browserChrome;
}
}
}

0 comments on commit 839af54

Please sign in to comment.