curl with cookies
Find a file
heming 63bbced5bd
All checks were successful
Test Suite / test (push) Successful in 20s
Add test cases for WebSocket page existence check
2025-06-13 14:02:01 +02:00
.forgejo/workflows Remove artifact upload step from test workflow 2025-06-13 13:46:09 +02:00
.gitignore Add built file 2025-06-10 18:37:06 +02:00
.npmignore Add CSRF feature and current url 2025-06-12 20:12:26 +02:00
index.js Fix WebSocket connection by checking for existing page 2025-06-13 14:01:14 +02:00
package-lock.json VIP Vibe in progress... 2025-06-13 10:33:53 +02:00
package.json Change license from MIT to GPLv3 in package.json 2025-06-13 13:48:31 +02:00
README.md Update README to clarify tool's purpose as 'curl with cookies' for retrieving cookies and CSRF tokens from Chromium. 2025-06-13 13:30:20 +02:00
test.js Add test cases for WebSocket page existence check 2025-06-13 14:02:01 +02:00

curlwc

curl with cookies - A tool to retrieve cookies and CSRF tokens from Chromium and use them with curl.

Security Warning

This tool launches Chromium with remote debugging enabled on port 9222 without authentication. While the debugging interface is only accessible via localhost, it still allows any local process to access your browser's debugging interface and potentially access your cookies and browser data. Use this tool only for development purposes.

Usage

curlwc <url|current> [curl_args...]

or

curlwc browser [profile_dir]

Options

  • <url|current>: The URL to retrieve cookies and CSRF tokens from, or 'current' to use the active tab.
  • [curl_args...]: Additional arguments to pass to curl.

Default Profile

The default profile directory is ~/.dev-chrome-profile.

Manual Browser Launch

To launch Chromium manually, use:

chromium --remote-debugging-port=9222 --user-data-dir=[profile_path]

Replace [profile_path] with the path to the profile directory.

Example

Let's say you want to check some responses that need login on your local development server. Start by starting the debug browser:

curlwc browser /tmp/dev-browser-profile

By default ~/.dev-chrome-profile is used as profile dir.

Login to your app. Now you can use curlwc to "curl" your app as a logged in user:

curlwc http://localhost:8080 -L -o /dev/null -v

The current active page can be used with curlwc current [...].

If the current active page contains a "CSRF Token" meta Tag, its content attribute's value is provided to curl as a HTTP header.

To save the cookies in a jar for other uses, provide -c cookieJar.txt. This tells curl to save all cookies to this file.

Install

sudo npm i -g curlwc