puppeteer-extra-plugin-stealth
Advanced tools
Comparing version 2.4.11 to 2.4.12
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/_template/index.js#L10-L24) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/_template/index.js#L10-L24) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L15-L44) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L15-L44) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/console.debug/index.js#L8-L24) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/console.debug/index.js#L8-L24) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js#L11-L125) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js#L11-L125) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -10,3 +10,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L9-L89) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L9-L89) | ||
@@ -22,3 +22,3 @@ - `opts` (optional, default `{}`) | ||
### [parseInput(arg)](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L31-L45) | ||
### [parseInput(arg)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L31-L45) | ||
@@ -25,0 +25,0 @@ - `arg` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** |
@@ -7,2 +7,5 @@ 'use strict' | ||
* Pass the Languages Test. | ||
* | ||
* @param {Object} [opts] - Options | ||
* @param {Array<string>} [opts.languages] - The user agent to use (default: `['en-US', 'en']`) | ||
*/ | ||
@@ -19,8 +22,8 @@ class Plugin extends PuppeteerExtraPlugin { | ||
async onPageCreated(page) { | ||
await page.evaluateOnNewDocument(() => { | ||
await page.evaluateOnNewDocument(opts => { | ||
// Overwrite the `languages` property to use a custom getter. | ||
Object.defineProperty(navigator, 'languages', { | ||
get: () => ['en-US', 'en'] // TODO: Make configurable by user | ||
get: () => opts.languages || ['en-US', 'en'] | ||
}) | ||
}) | ||
}, this.opts) | ||
} | ||
@@ -27,0 +30,0 @@ } |
@@ -21,1 +21,8 @@ const test = require('ava') | ||
}) | ||
test('stealth: customized value', async t => { | ||
const { languages } = await getStealthFingerPrint(Plugin, null, { | ||
languages: ['foo', 'bar'] | ||
}) | ||
t.deepEqual(languages, ['foo', 'bar']) | ||
}) |
@@ -9,5 +9,6 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js#L8-L25) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js#L11-L28) | ||
- `opts` (optional, default `{}`) | ||
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) | ||
- `opts.languages` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** The user agent to use (default: `['en-US', 'en']`) | ||
@@ -14,0 +15,0 @@ **Extends: PuppeteerExtraPlugin** |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js#L8-L53) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js#L8-L53) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js#L10-L216) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js#L10-L216) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js#L9-L33) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js#L9-L33) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
@@ -117,4 +117,6 @@ const test = require('ava') | ||
const lang = await page.evaluate(() => navigator.languages) | ||
t.true(lang.length === 2 && lang[0] === 'de-DE' && lang[1] === 'de') | ||
const langs = await page.evaluate(() => navigator.languages) | ||
t.deepEqual(langs, ['de-DE', 'de']) | ||
const lang = await page.evaluate(() => navigator.language) | ||
t.deepEqual(lang, 'de-DE') | ||
}) | ||
@@ -121,0 +123,0 @@ |
@@ -7,2 +7,6 @@ 'use strict' | ||
* Fix WebGL Vendor/Renderer being set to Google in headless mode | ||
* | ||
* @param {Object} [opts] - Options | ||
* @param {string} [opts.vendor] - The vendor string to use (default: `Intel Inc.`) | ||
* @param {string} [opts.renderer] - The renderer string (default: `Intel Iris OpenGL Engine`) | ||
*/ | ||
@@ -21,3 +25,3 @@ class Plugin extends PuppeteerExtraPlugin { | ||
// Chrome returns undefined, Firefox false | ||
await page.evaluateOnNewDocument(() => { | ||
await page.evaluateOnNewDocument(opts => { | ||
try { | ||
@@ -49,7 +53,7 @@ // Remove traces of our Proxy ;-) | ||
if (param === 37445) { | ||
return 'Intel Inc.' | ||
return opts.vendor || 'Intel Inc.' | ||
} | ||
// UNMASKED_RENDERER_WEBGL | ||
if (param === 37446) { | ||
return 'Intel Iris OpenGL Engine' | ||
return opts.renderer || 'Intel Iris OpenGL Engine' | ||
} | ||
@@ -79,3 +83,3 @@ try { | ||
} | ||
}) | ||
}, this.opts) | ||
} | ||
@@ -82,0 +86,0 @@ } |
@@ -21,2 +21,11 @@ const test = require('ava') | ||
test('stealth: customized values', async t => { | ||
const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line | ||
const { videoCard } = await getStealthFingerPrint(Plugin, pageFn, { | ||
vendor: 'foo', | ||
renderer: 'bar' | ||
}) | ||
t.deepEqual(videoCard, ['foo', 'bar']) | ||
}) | ||
/* global WebGLRenderingContext */ | ||
@@ -23,0 +32,0 @@ async function extendedTests() { |
@@ -9,5 +9,7 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js#L8-L78) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js#L12-L82) | ||
- `opts` (optional, default `{}`) | ||
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) | ||
- `opts.vendor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The vendor string to use (default: `Intel Inc.`) | ||
- `opts.renderer` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The renderer string (default: `Intel Iris OpenGL Engine`) | ||
@@ -14,0 +16,0 @@ **Extends: PuppeteerExtraPlugin** |
@@ -9,3 +9,3 @@ ## API | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js#L9-L40) | ||
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js#L9-L40) | ||
@@ -12,0 +12,0 @@ - `opts` (optional, default `{}`) |
{ | ||
"name": "puppeteer-extra-plugin-stealth", | ||
"version": "2.4.11", | ||
"version": "2.4.12", | ||
"description": "Stealth mode: Applies various techniques to make detection of headless puppeteer harder.", | ||
@@ -49,5 +49,5 @@ "main": "index.js", | ||
"debug": "^4.1.1", | ||
"puppeteer-extra-plugin": "^3.1.5" | ||
"puppeteer-extra-plugin": "^3.1.6" | ||
}, | ||
"gitHead": "c4112a26517141a35d690faef5a9de75c4a69b5f" | ||
"gitHead": "d35cc36fd80afbe9aa3f04496d7b919ee23d65a0" | ||
} |
@@ -186,3 +186,3 @@ # puppeteer-extra-plugin-stealth [![Build Status](https://travis-ci.org/berstend/puppeteer-extra.svg?branch=master)](https://travis-ci.org/berstend/puppeteer-extra) [![npm](https://img.shields.io/npm/v/puppeteer-extra-plugin-stealth.svg)](https://www.npmjs.com/package/puppeteer-extra-plugin-stealth) | ||
### class: [StealthPlugin](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/index.js#L72-L159) | ||
### class: [StealthPlugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/index.js#L72-L159) | ||
@@ -265,3 +265,3 @@ - `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) | ||
#### .[availableEvasions](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/index.js#L125-L127) | ||
#### .[availableEvasions](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/index.js#L125-L127) | ||
@@ -284,3 +284,3 @@ Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** | ||
#### .[enabledEvasions](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/index.js#L142-L144) | ||
#### .[enabledEvasions](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/index.js#L142-L144) | ||
@@ -304,3 +304,3 @@ Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** | ||
### [defaultExport(opts?)](https://github.com/berstend/puppeteer-extra/blob/bd73a05835ef5bd19565330188ad69d49431b7ea/packages/puppeteer-extra-plugin-stealth/index.js#L167-L167) | ||
### [defaultExport(opts?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin-stealth/index.js#L167-L167) | ||
@@ -307,0 +307,0 @@ - `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options |
@@ -30,4 +30,4 @@ const vanillaPuppeteer = require('puppeteer') | ||
getFingerPrint(vanillaPuppeteer, pageFn) | ||
const getStealthFingerPrint = async (Plugin, pageFn) => | ||
getFingerPrint(addExtra(vanillaPuppeteer).use(Plugin()), pageFn) | ||
const getStealthFingerPrint = async (Plugin, pageFn, pluginOptions = null) => | ||
getFingerPrint(addExtra(vanillaPuppeteer).use(Plugin(pluginOptions)), pageFn) | ||
@@ -34,0 +34,0 @@ module.exports = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
575712
2168