Merge pull request #248 from vbanos/stealth2

Add more stealth evasions
This commit is contained in:
Barbara Miller 2022-08-12 10:40:34 -07:00 committed by GitHub
commit 50c2b424c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,34 @@ WebGLRenderingContext.prototype.getParameter = function(origFn) {
}; };
}(WebGLRenderingContext.prototype.getParameter); }(WebGLRenderingContext.prototype.getParameter);
// This is `Linux x86_64` on Linux.
Object.defineProperty(navigator, 'platform', {
get: () => 'Win32'
});
// Randomize navigator.deviceMemory and navigator.hardwareConcurrency to evade
// browser fingerprinting.
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
}
Object.defineProperty(navigator, 'deviceMemory', {
get: () => getRandomInt(4, 32)
});
Object.defineProperty(navigator, 'hardwareConcurrency', {
get: () => getRandomInt(4, 32)
});
// Brozzler runs chrome with --disable-notifications which disables `window.Notification`.
// This object is used for web bot detection and should be there.
if (!window.Notification) {
window.Notification = {
permission: 'denied'
}
}
// TODO Add many more feature detection evations here. For example: // TODO Add many more feature detection evations here. For example:
// Mock navigator.permissions.query. In headful on secure origins the // Mock navigator.permissions.query. In headful on secure origins the
// permission should be "default", not "denied". // permission should be "default", not "denied".