New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browser-exec

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-exec

A small library to execute code in a browser without the need for pupeteer or selenium.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

BrowserExec

⚠️ This project is in a very early stage and should not be used in production

What

This is a small library I hacked together. It aims to make it very easy to "connect" a browser like chrome to your Node.js project, and allows you to execute JavaScript in the browser context, without using libraries like puppeteer or selenium. These libraries can easily be detected by anti-bot solutions, a normal chrome browser not.

Why

This makes this library perfect for writing half-assed bypasses to anti-bot solutions like cloudflare, without solving all of the challenges entirely. This is especially useful for stuff like canvas fingerprinting, which cannot easily be "faked" or solved in Node.js

How

The Node.js context communicates with the browser using websockets. This means one browser instance can be used for a lot of concurrent tasks, making it relatively performant.

You can either manually open the browser, or open it using command line arguments

const BrowserExec = require('browser-exec');
const { exec } = require('child_process');

// config
const binaryPath =
  '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome'; // different on windows or linux
const host = 'localhost';
const port = '9090';
const debug = true;

const executor = new BrowserExec(port, host, debug); // host and debug are optional. Default: localhost, false

executor.listen();
executor.onConnect = async () => {
  const res = await executor.exec('window.location.href');
  console.log('Result:', res);
};
exec(`${binaryPath} --homepage http://${host}:${port}`);

Keywords

FAQs

Package last updated on 06 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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