Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-extra-plugin-stealth

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-extra-plugin-stealth - npm Package Compare versions

Comparing version 2.2.5 to 2.3.1

index.d.ts

12

evasions/_template/readme.md

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/_template/index.js#L10-L20)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/_template/index.js#L10-L24)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -18,6 +20,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L10-L22)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L10-L26)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -18,6 +20,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/console.debug/index.js#L8-L18)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/console.debug/index.js#L8-L24)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -16,6 +18,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js#L8-L21)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js#L8-L25)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -16,6 +18,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js#L8-L46)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js#L8-L53)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -16,6 +18,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js#L10-L216)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js#L10-L216)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -18,6 +20,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js#L9-L28)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js#L9-L28)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -17,6 +19,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -5,8 +5,10 @@ # puppeteer-extra-plugin-stealth/evasions

You can bypass the main module and require specific evasion plugins yourself, if you whish to do so:
You can bypass the main module and require specific evasion plugins yourself, if you wish to do so:
```es6
puppeteer.use(require('puppeteer-extra-plugin-stealth/evasions/console.debug')())
puppeteer.use(
require('puppeteer-extra-plugin-stealth/evasions/console.debug')()
)
```
If you want to add a new evasion technique I suggest you look at the [template](./_template/) to kickstart things.

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/user-agent/index.js#L13-L19)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/user-agent/index.js#L13-L25)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -21,6 +23,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js#L8-L37)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js#L8-L37)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -16,6 +18,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -7,6 +7,8 @@ ## API

- [Plugin](#plugin)
- [class: Plugin](#class-plugin)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js#L9-L39)
### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js#L9-L39)
- `opts` (optional, default `{}`)
**Extends: PuppeteerExtraPlugin**

@@ -17,6 +19,2 @@

Type: `function (opts)`
- `opts` (optional, default `{}`)
* * *
---

@@ -68,7 +68,7 @@ 'use strict'

*
* @param {Object} opts - Options
* @param {Object} [opts] - Options
* @param {Set<string>} [opts.enabledEvasions] - Specify which evasions to use (by default all)
*
*/
class Plugin extends PuppeteerExtraPlugin {
class StealthPlugin extends PuppeteerExtraPlugin {
constructor(opts = {}) {

@@ -153,4 +153,13 @@ super(opts)

module.exports = function(pluginConfig) {
return new Plugin(pluginConfig)
}
/**
* Default export, PuppeteerExtraStealthPlugin
*
* @param {Object} [opts] - Options
* @param {Set<string>} [opts.enabledEvasions] - Specify which evasions to use (by default all)
*/
const defaultExport = opts => new StealthPlugin(opts)
module.exports = defaultExport
// const moduleExport = defaultExport
// moduleExport.StealthPlugin = StealthPlugin
// module.exports = moduleExport

@@ -14,3 +14,3 @@ 'use strict'

test('should have the basic class members', async t => {
const instance = new Plugin()
const instance = Plugin()
t.is(instance.name, PLUGIN_NAME)

@@ -21,3 +21,3 @@ t.true(instance._isPuppeteerExtraPlugin)

test('should have the public child class members', async t => {
const instance = new Plugin()
const instance = Plugin()
const prototype = Object.getPrototypeOf(instance)

@@ -36,3 +36,3 @@ const childClassMembers = Object.getOwnPropertyNames(prototype)

test('should have opts with default values', async t => {
const instance = new Plugin()
const instance = Plugin()
t.deepEqual(instance.opts.enabledEvasions, instance.availableEvasions)

@@ -42,3 +42,3 @@ })

test('should add all dependencies dynamically', async t => {
const instance = new Plugin()
const instance = Plugin()
const deps = new Set(

@@ -51,3 +51,3 @@ [...instance.opts.enabledEvasions].map(e => `${PLUGIN_NAME}/evasions/${e}`)

test('should add all dependencies dynamically including changes', async t => {
const instance = new Plugin()
const instance = Plugin()
const fakeDep = 'foobar'

@@ -54,0 +54,0 @@ instance.enabledEvasions = new Set([fakeDep])

{
"name": "puppeteer-extra-plugin-stealth",
"version": "2.2.5",
"version": "2.3.1",
"description": "Stealth mode: Applies various techniques to make detection of headless puppeteer harder.",
"main": "index.js",
"typings": "index.d.ts",
"repository": "berstend/puppeteer-extra",

@@ -11,6 +12,8 @@ "homepage": "https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth#readme",

"scripts": {
"docs": "update-markdown-jsdoc && yarn docs-for-evasions",
"docs-for-evasions": "cd ./evasions && loop update-markdown-jsdoc",
"docs": "yarn docs-for-plugin && yarn docs-for-evasions && yarn types",
"docs-for-plugin": "documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API index.js && npx prettier --write readme.md",
"docs-for-evasions": "cd ./evasions && loop \"documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API index.js && npx prettier --write readme.md\"",
"test": "ava -v && eslint --ext .js .",
"test-ci": "yarn test"
"test-ci": "yarn test",
"types": "npx --package typescript@3.7 tsc --emitDeclarationOnly --declaration --allowJs index.js"
},

@@ -34,12 +37,12 @@ "engines": {

"ava": "2.4.0",
"documentation-markdown-themes": "^12.1.5",
"loop": "^3.0.6",
"puppeteer": "^2.0.0",
"update-markdown-jsdoc": "^1.0.11"
"puppeteer": "^2.0.0"
},
"dependencies": {
"debug": "^4.1.1",
"puppeteer-extra-plugin": "^3.0.7",
"puppeteer-extra-plugin-anonymize-ua": "^2.1.7"
"puppeteer-extra-plugin": "^3.1.1",
"puppeteer-extra-plugin-anonymize-ua": "^2.2.1"
},
"gitHead": "21cf62f8aaa2b72479155ea02f178355a284080b"
"gitHead": "e4f04742f62bd66ae968229879b6f278b1e6146b"
}

@@ -26,6 +26,6 @@ # 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)

// it augments the installed puppeteer with plugin functionality
const puppeteer = require("puppeteer-extra")
const puppeteer = require('puppeteer-extra')
// add stealth plugin and use defaults (all evasion techniques)
const pluginStealth = require("puppeteer-extra-plugin-stealth")
const pluginStealth = require('puppeteer-extra-plugin-stealth')
puppeteer.use(pluginStealth())

@@ -37,5 +37,5 @@

await page.setViewport({ width: 800, height: 600 })
await page.goto("https://bot.sannysoft.com")
await page.goto('https://bot.sannysoft.com')
await page.waitFor(5000)
await page.screenshot({ path: "testresult.png", fullPage: true })
await page.screenshot({ path: 'testresult.png', fullPage: true })
await browser.close()

@@ -107,3 +107,3 @@ })

- [Plugin](#plugin)
- [class: StealthPlugin](#class-stealthplugin)
- [Purpose](#purpose)

@@ -113,7 +113,11 @@ - [Modularity](#modularity)

- [Kudos](#kudos)
- [availableEvasions](#availableevasions)
- [enabledEvasions](#enabledevasions)
- [.availableEvasions](#availableevasions)
- [.enabledEvasions](#enabledevasions)
- [defaultExport(opts?)](#defaultexportopts)
### [Plugin](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/index.js#L72-L151)
### class: [StealthPlugin](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/index.js#L72-L150)
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`)
- `opts.enabledEvasions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Specify which evasions to use (by default all)
**Extends: PuppeteerExtraPlugin**

@@ -146,3 +150,3 @@

puppeteer.use(
require("puppeteer-extra-plugin-stealth/evasions/console.debug")()
require('puppeteer-extra-plugin-stealth/evasions/console.debug')()
)

@@ -162,17 +166,12 @@ ```

Type: `function (opts)`
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`)
- `opts.enabledEvasions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Specify which evasions to use (by default all)
Example:
```javascript
const puppeteer = require("puppeteer-extra")
const puppeteer = require('puppeteer-extra')
// Enable stealth plugin with all evasions
puppeteer.use(require("puppeteer-extra-plugin-stealth")())
puppeteer.use(require('puppeteer-extra-plugin-stealth')())
;(async () => {
// Launch the browser in headless mode and set up a page.
const browser = await puppeteer.launch({
args: ["--no-sandbox"],
args: ['--no-sandbox'],
headless: true

@@ -184,10 +183,10 @@ })

const testUrl =
"https://intoli.com/blog/" +
"not-possible-to-block-chrome-headless/chrome-headless-test.html"
'https://intoli.com/blog/' +
'not-possible-to-block-chrome-headless/chrome-headless-test.html'
await page.goto(testUrl)
// Save a screenshot of the results.
const screenshotPath = "/tmp/headless-test-result.png"
const screenshotPath = '/tmp/headless-test-result.png'
await page.screenshot({ path: screenshotPath })
console.log("have a look at the screenshot:", screenshotPath)
console.log('have a look at the screenshot:', screenshotPath)

@@ -200,4 +199,6 @@ await browser.close()

#### [availableEvasions](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/index.js#L124-L126)
#### .[availableEvasions](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/index.js#L123-L125)
Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
Get all available evasions.

@@ -207,8 +208,6 @@

Type: [Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>
Example:
```javascript
const pluginStealth = require("puppeteer-extra-plugin-stealth")()
const pluginStealth = require('puppeteer-extra-plugin-stealth')()
console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' }

@@ -220,4 +219,6 @@ puppeteer.use(pluginStealth)

#### [enabledEvasions](https://git@github.com/:berstend/puppeteer-extra/blob/ff112879545e8e68d6500d731ceeafc22d187dd3/packages/puppeteer-extra-plugin-stealth/index.js#L141-L143)
#### .[enabledEvasions](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/index.js#L140-L142)
Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
Get all enabled evasions.

@@ -227,4 +228,2 @@

Type: [Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>
Example:

@@ -234,4 +233,4 @@

// Remove specific evasion from enabled ones dynamically
const pluginStealth = require("puppeteer-extra-plugin-stealth")()
pluginStealth.enabledEvasions.delete("console.debug")
const pluginStealth = require('puppeteer-extra-plugin-stealth')()
pluginStealth.enabledEvasions.delete('console.debug')
puppeteer.use(pluginStealth)

@@ -241,1 +240,14 @@ ```

---
### [defaultExport(opts?)](https://github.com/berstend/puppeteer-extra/blob/fa3ecf77b786a97a4415812fc31ae5d97b71abe0/packages/puppeteer-extra-plugin-stealth/index.js#L158-L158)
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options
- `opts.enabledEvasions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Specify which evasions to use (by default all)
Default export, PuppeteerExtraStealthPlugin
---
## License
Copyright © 2019, [berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘](mailto:github@berstend.com?subject=[GitHub]%20PuppeteerExtra). Released under the MIT License.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc