Skip to main content

Drive Chrome's DevTools Protocol over a unix domain socket

Project description

unix-chrome-cli

Connect to the chrome dev socket running via unix domain socket.

Motivation

I don't like having privileged services run on localhost. In theory, you could run everything in docker / network jails but it is a pain. Unix domain sockets are a nice alternative to TCP ip sockets with limited access.

Using netns-jail (by me) you can route traffic that would go through TCP ip on localhost through a unix domain socket. Once you have done this, this tool lets you connect to chrome's development socket through unix domain sockets.

Alternatives

You don't need to use this at all. You could just let things run on localhost and connect to this. Ther are then a variety of tools you can use. You can use playwright. You can use selenium.

You could make a similar netns style wrapper with socat running in it to redirect TCP connections to unix domain socket.

Installation

pipx install unix-chrome-cli

Usage

Start chrome in a jail with a unix domain socket port.

netns-jail --nat --dns --forward /tmp/chrome.sock:localhost:9222 -- google-chrome --user-data-dir=/tmp/cj --remote-debugging-port=9222

Connect uchrome set-socket /tmp/chrome.sock

You can then run various commands.

  • uchrome go url
  • uchrome back
  • uchrome dom

LLM use

You can then use this with something like claude code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unix_chrome_cli-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unix_chrome_cli-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file unix_chrome_cli-0.1.0.tar.gz.

File metadata

  • Download URL: unix_chrome_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for unix_chrome_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fcd0af0c845bd578b6486e501136eda96c1de9d59fbde0068e0e6e6d62233f8a
MD5 547530ab825a7c392341bb5699f9b65c
BLAKE2b-256 4d735b1eeb232ac65f3e3e5d542f58ccbdb7456874f5d6414f5ca3bc8f2e3e04

See more details on using hashes here.

File details

Details for the file unix_chrome_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unix_chrome_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b322cfbccb66f833caa5fb26a1394c645bd60b32598e5dbb754cb257f88647a1
MD5 f5bb5958db32bbdce2a9c498c9e213a9
BLAKE2b-256 b839c835c40a26f5aa7a7ad1c296fd4e20867aa37434a58711379394cc1e05fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page