{"id":17527020,"url":"https://github.com/saidsay-so/gateau","last_synced_at":"2025-08-17T14:36:37.046Z","repository":{"id":65405345,"uuid":"573925415","full_name":"saidsay-so/gateau","owner":"saidsay-so","description":":cookie: Use your cookies from browsers in your curl, wget and httpie requests!","archived":false,"fork":false,"pushed_at":"2024-12-08T22:55:05.000Z","size":757,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T05:03:06.904Z","etag":null,"topics":["advent-of-code","adventofcode","chrome","cli","command-line","cookies","curl","firefox","hacktoberfest","httpie","rust","wget"],"latest_commit_sha":null,"homepage":"https://saidsay-so.github.io/gateau/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saidsay-so.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"saidsay-so","buy_me_a_coffee":"saidsayso"}},"created_at":"2022-12-03T21:36:16.000Z","updated_at":"2025-05-26T02:59:16.000Z","dependencies_parsed_at":"2023-02-12T17:00:53.045Z","dependency_job_id":"6e4204ac-1c73-4de9-a6b3-c2173856ff9c","html_url":"https://github.com/saidsay-so/gateau","commit_stats":null,"previous_names":["saidsay-so/gateau"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/saidsay-so/gateau","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saidsay-so%2Fgateau","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saidsay-so%2Fgateau/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saidsay-so%2Fgateau/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saidsay-so%2Fgateau/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saidsay-so","download_url":"https://codeload.github.com/saidsay-so/gateau/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saidsay-so%2Fgateau/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270860421,"owners_count":24658393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","adventofcode","chrome","cli","command-line","cookies","curl","firefox","hacktoberfest","httpie","rust","wget"],"created_at":"2024-10-20T15:02:57.148Z","updated_at":"2025-08-17T14:36:36.960Z","avatar_url":"https://github.com/saidsay-so.png","language":"Rust","funding_links":["https://github.com/sponsors/saidsay-so","https://buymeacoffee.com/saidsayso"],"categories":["Rust"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# gateau 🍰\n\n![Demo](assets/demo.gif)\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/saidsay-so/gateau/releases/latest\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/saidsay-so/gateau\" alt=\"Latest release\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/saidsay-so/gateau/actions\"\u003e\n    \u003cimg src=\"https://github.com/saidsay-so/gateau/actions/workflows/test.yml/badge.svg\" alt=\"GitHub Workflow Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/saidsay-so/gateau/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/saidsay-so/gateau\" alt=\"License\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nPiping your **cookies** will be a piece of **cake** 🍰!\n\ngateau is a command line tool to use your cookies from browsers (Chromium/Chrome and Firefox)\nin your **curl**, **wget** and **httpie\\*** requests or export them to a file.\n\n\u003c/div\u003e\n\n## Installation\n\ngateau supports all platforms supported by the browsers and the Rust toolchain,\nincluding Linux, macOS and Windows.\n\n### SQLite dependency\n\nPlease note that if you download one of the pre-built releases,\nSQLite will be bundled with the executable and gateau will not require SQLite to be installed.\nIf you want to use the system's SQLite instead, you will have to build gateau from source.\n\n### From source\n\n```bash\n# You can remove the `--feautures=bundled` flag if you have SQLite installed\n# on your system and want to use the system's SQLite instead of the bundled one.\ncargo install --git github.com/musikid/gateau --features=bundled\n```\n\n### From binaries\n\nDownload the latest release from [here](https://github.com/musikid/gateau/releases/latest).\n\n## Usage\n\ngateau can be used to output cookies in different formats, notably `netscape`\nformat which is used by curl and wget to import cookies from a file,\nand httpie sessions.\nIt can also be used to wrap commands (curl, wget, httpie) and import cookies directly without\nhaving to use shell's [process substitution](https://en.wikipedia.org/wiki/Process_substitution)\nor manually create temporary files.\nIt imports cookies from Firefox by default if the `--browser` flag is not specified.\n\n### Support\n\n#### Browsers\n\n- Google Chrome\n- Chromium\n- Microsoft Edge\n- Firefox\n\nNote: Since almost all other browsers are Chrome derivatives, it should be straightforward to\nadd support for them. Please open an issue if you would like to add one!\n\n#### Output formats\n\n- Netscape \"cookies.txt\"\n- httpie session (experimental)\n\n### Output (piping) cookies\n\n#### cookies.txt format (curl, wget)\n\nSince curl and wget can import cookies from a file in Netscape \"cookies.txt\" format,\ngateau can be used to output cookies in this format and pipe them to curl/wget.\n\n```bash\ncurl -b \u003c(gateau output --format netscape) https://example.com\n```\n\nIn this example, gateau will output cookies from Firefox in Netscape format,\nand curl will import those which match the requested domains\nand use them for the request.\n\n```bash\nwget --load-cookies \u003c(gateau output --browser=chrome --format netscape) https://example.com\n```\n\nSince wget can also import cookies from a file in Netscape \"cookies.txt\" format,\ngateau can be used to output cookies in this format and pipe them to wget.\n\n#### httpie sessions\n\ngateau can also output cookies in httpie sessions format.\nThe support is experimental though, as httpie session format is neither documented nor stable.\nThe current implementation should be compatible with httpie 3.2.0+,\nbut it could change if httpie stop supporting this format in the future.\n\n```bash\nhttp --session-read-only \u003c(gateau output --format httpie-session example.com) example.com\n```\n\nIn this example, gateau will output cookies from Firefox in httpie session format,\nand httpie will import it as an anonymous session.\n\nYou can also save named sessions,\nby writing them to file which can be then used with `https --session`:\n\n```bash\n# TODO: Maybe add a dedicated feature?\n# Just an example, should be changed\nHOST=adventofcode.com\nSESSION_NAME=aoc\n# Usual path for httpie sessions on Unix systems, see https://httpie.io/docs#sessions\n# and https://httpie.io/docs/cli/config-file-directory\nCONFIG_PATH=${XDG_CONFIG_HOME:-$HOME/.config}\ngateau output --format=httpie-session $HOST \u003e $CONFIG_PATH/httpie/sessions/$HOST/$SESSION_NAME.json\nhttps --session=$SESSION_NAME $HOST\n```\n\n### Browser session\n\nIt is possible to use gateau to create a browser session within a new context,\nand export the cookies after the session termination.\n\n```bash\ngateau wrap --browser=chromium --session -- curl https://example.com\n```\n\n```bash\ngateau output --session https://example.com\n```\n\n### Windows users\n\nIf you are using Windows, you can either use a shell which supports process substitution\n(bash, zsh, fish, etc.) or use the `wrap` command.\n\n### Wrapping commands\n\ngateau can also wrap commands (curl, wget, httpie) and import cookies for them.\n\n```bash\ngateau wrap curl https://example.com\n```\n\nThis will wrap the command `curl https://example.com` and import cookies for the request.\n\n```bash\ncat data | gateau wrap curl --bypass-lock -- -X POST -d @- httpbin.org/post\n```\n\nThis will wrap the command `curl -X POST -d @- httpbin.org/post` and import cookies for the request.\nThe arguments and standard input are directly forwarded to the wrapped command,\nso you can use them as usual.\nThey are separated from the gateau arguments by `--`, so gateau will not parse them.\nNote that it is optional if you do not use gateau arguments after the wrapped command, e.g:\n\n```bash\ncat data | gateau wrap curl --bypass-lock -- -X POST -d @- httpbin.org/post\n```\n\nis equivalent to:\n\n```bash\ncat data | gateau --bypass-lock wrap curl -X POST -d @- httpbin.org/post\n```\n\nhttpie is also supported (experimental, as stated in [httpie sessions](#httpie-sessions)):\n\n```bash\ngateau wrap --browser=chromium http GET https://example.com\n```\n\n### Piping vs wrapping\n\ngateau can be used mostly in two ways to import cookies: piping or wrapping.\n\n#### Piping with process substitution\n\nPiping is the most common way to use gateau, as it is the most flexible.\nIt allows you to use gateau with any command, as long as the used shell supports\n[process substitution](https://en.wikipedia.org/wiki/Process_substitution).\nIt is the most secure, as it does not use a temporary file\nto pass the cookies to the command.\nHowever, it is not always\n[possible](https://serverfault.com/questions/688645/powershells-equivalent-to-bashs-process-substitution)\nto use process substitution,\nas it is not supported by all shells (cmd.exe or Powershell for example).\n\n#### Wrapping\n\nWrapping allows you to use gateau with a command without process substitution\nand avoids having to manually create temporary files,\nas long as the command is supported by gateau.\n\n### Bypass database file locking\n\nBe aware that this flag is not recommended, as it could cause read errors\nif the database is being modified at the same time, especially with Chrome.\nThe best solution is to wait for the browser to finish its operations and close it.\n\nWhen Firefox is running, or when Chrome saves its cookies,\nthey lock their database files, so gateau cannot access\nthem. To bypass this, you can use the `--bypass-lock` flag.\nAlthough, the database files are opened in read-only mode,\nso your cookies should not be altered if an error occurs.\n\n### Aliases\n\nYou can define aliases to make gateau easier to use.\nFor example, you can add the following aliases to your shell configuration file:\n\n```bash\nalias curlfire=\"curl -b \u003c(gateau output --format netscape)\"\nalias chrul=\"curl -b \u003c(gateau output --format netscape --browser chromium)\"\nalias wgetfire=\"wget --load-cookies \u003c(gateau output --format netscape)\"\nalias wgetchr=\"wget --load-cookies \u003c(gateau output --format netscape --browser chromium)\"\nalias httpfire=\"http --session-read-only \u003c(gateau output --format httpie-session)\"\nalias httpchr=\"http --session-read-only \u003c(gateau output --format httpie-session --browser chromium)\"\nalias httpsfire=\"https --session-read-only \u003c(gateau output --format httpie-session)\"\nalias httpschr=\"https --session-read-only \u003c(gateau output --format httpie-session --browser chromium)\"\n```\n\nPlease note that this would probably not work as intended\nif you use `curl` with [`-:`](https://curl.se/docs/manpage.html) and multiple URLs,\nas the cookies would be imported for the first request only.\n\n## Help\n\n```\n\u003e gateau --help\n\nA simple wrapper to import cookies from browsers for curl, wget and httpie.\n\nUsage: gateau [-r=ARG] [--session] [--session-urls=ARG]... [-b=ARG] [--bypass-lock] COMMAND ...\n\nAvailable options:\n    -r, --root-path=ARG     Browser root path\n        --session           Open the browser in a new context and use the saved cookies when it\n                            closes\n        --session-urls=ARG  URLs to open in the session\n    -b, --browser=ARG       Browser(s) to import cookies from\n        --bypass-lock       Bypass the lock on the database (can cause read errors)\n    -h, --help              Prints help information\n    -V, --version           Prints version information\n\nAvailable commands:\n    output                  Output cookies to stdout in the specified format\n    wrap                    Wrap a command with the imported cookies\n\n\n\u003e gateau output --help\n\nOutput cookies to stdout in the specified format\n\nUsage: [--format ARG] \u003cHOSTS\u003e...\n\nAvailable positional items:\n    \u003cHOSTS\u003e  Hosts to filter cookies by\n\nAvailable options:\n        --format \u003cARG\u003e  Output format\n                        Supported formats: netscape, httpie-session\n    -h, --help          Prints help information\n\n\u003e gateau wrap --help\n\nWrap a command with the imported cookies\n\nUsage: \u003cCOMMAND\u003e \u003cARGS\u003e...\n\nAvailable positional items:\n    \u003cCOMMAND\u003e  Command which should be wrapped\n               Supported commands: curl, wget, http, https\n    \u003cARGS\u003e     Arguments for the wrapped command\n\nAvailable options:\n    -h, --help  Prints help information\n```\n\n## Performance\n\ngateau is written in Rust, so it should be pretty fast, even if it is not\nreally optimized yet. Here are some non-rigorous benchmarks:\n\n```\nBenchmark 1: gateau wrap --bypass-lock curl localhost:8000\n  Time (mean ± σ):      10.9 ms ±   2.4 ms    [User: 5.4 ms, System: 5.5 ms]\n  Range (min … max):     7.0 ms …  16.6 ms    1000 runs\n\nBenchmark 2: curl -b \u003c(gateau --bypass-lock output) localhost:8000\n  Time (mean ± σ):       8.3 ms ±   2.6 ms    [User: 4.3 ms, System: 4.0 ms]\n  Range (min … max):     4.1 ms …  15.3 ms    1000 runs\n\n  Warning: Command took less than 5 ms to complete. Note that the results might be inaccurate because hyperfine can not calibrate the shell startup time much more precise than this limit. You can try to use the `-N`/`--shell=none` option to disable the shell completely.\n\nBenchmark 3: curl localhost:8000\n  Time (mean ± σ):       7.3 ms ±   2.5 ms    [User: 4.0 ms, System: 3.5 ms]\n  Range (min … max):     3.7 ms …  12.3 ms    1000 runs\n\n  Warning: Command took less than 5 ms to complete. Note that the results might be inaccurate because hyperfine can not calibrate the shell startup time much more precise than this limit. You can try to use the `-N`/`--shell=none` option to disable the shell completely.\n\nSummary\n  'curl localhost:8000' ran\n    1.15 ± 0.54 times faster than 'curl -b \u003c(gateau --bypass-lock output) localhost:8000'\n    1.50 ± 0.62 times faster than 'gateau wrap --bypass-lock curl localhost:8000'\n```\n\n\u003e The benchmarks were done with [hyperfine](https://github.com/sharkdp/hyperfine),\n\u003e with a Firefox cookie database containing around 1000 cookies\n\u003e and most importantly, with a _laptop_.\n\nThe results are not really consistent, as the benchmarks were done on a laptop,\nbut it seems that gateau incurs only a tiny overhead\nwhich is not really noticeable in most cases.\n\nNote that it takes more time to import cookies from Chrome than Firefox,\nsince Chrome encrypts its cookies while Firefox does not.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaidsay-so%2Fgateau","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaidsay-so%2Fgateau","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaidsay-so%2Fgateau/lists"}