Giter Club home page Giter Club logo

rookie's Introduction

rookie

PyPi Downloads PyPi Version NPM Version Crates License

Load cookies from any browser on any platform

Features ๐Ÿš€

  • Available for Rust, Python, and JavaScript
  • Ensures type safety (e.g., TypeScript, Python with type hints)
  • Super Fast, Built with Rust
  • Bypass Chrome restriction like file locking
  • Read session cookies from Chrome based browsers! (requires admin rights on Windows)
  • Wide browsers support
  • Cross-platform support for Windows, Linux, and macOS

Usage โš™๏ธ

Rust

cargo add rookie

Create main.rs with the following

use rookie::brave;

fn main() {
    let domains = vec!["google.com"];
    let cookies = brave(Some(domains)).unwrap();
    for cookie in cookies {
        println!("{:?}", cookie);
    }
}

Python

pip install rookiepy

And the usage it similar to Rust

import rookiepy
cookies = rookiepy.firefox(["google.com"])
for cookie in cookies:
    print(cookie['domain'], cookie['value'])

JavaScript

npm install @rookie-rs/api
import { brave } from "@rookie-rs/api";
const cookies = brave();
for (const cookie of cookies) {
  console.log(cookie);
}

Examples ๐Ÿ“‹

Rust examples/rust

Python examples/python

JavaScript examples/javascript

Docs ๐Ÿ“˜

Rust

Python

JavaScript

CLI ๐Ÿ’ป

You can use rookie as a CLI tool which will decrypt the cookies and print it as JSON
See cli folder

Contribute ๐Ÿค

So far the following platforms are supported:

  • Brave: Linux, macOS, Windows
  • Cachy: Linux
  • Chrome: Linux, macOS, Windows
  • Chromium: Linux, macOS, Windows
  • Edge: Linux, macOS, Windows
  • Firefox: Linux, macOS, Windows
  • Internet Explorer: Windows
  • LibreWolf: Linux, macOS, Windows
  • Opera: Linux, macOS, Windows
  • Opera GX: macOS, Windows
  • Safari: macOS
  • Vivaldi: Linux, macOS, Windows

You are welcome to contribute support for other browsers, or other platforms.

Support new browsers ๐ŸŒ

If you have a browser with which the library isn't working with, it may not have been added to the list of supported browsers configs. You can create a pull request (PR) or an issue with the path to the cookies file on your computer, and I will add it.

look at src/windows/config.rs to see what configurations is needed.

Testing Dates (DD/MM/YY) ๐Ÿ“…

Browser Linux macOS Windows
Brave 01/10/23 25/11/23 01/10/23
Cachy 04/06/24 N/A N/A
Chromium 01/10/23 25/11/23 01/10/23
Chrome 01/10/23 25/11/23 16/03/24
Edge 01/10/23 - 01/10/23
Firefox 01/10/23 25/11/23 16/03/24
IE N/A N/A 01/10/23
LibreWolf 01/10/23 25/11/23 01/10/23
Opera 01/10/23 - 01/10/23
Opera GX N/A - 01/10/23
Safari N/A 02/10/23 N/A
Vivaldi 01/10/23 25/11/23 01/10/23

Credits ๐Ÿ™Œ

github.com/borisbabic/browser_cookie3

rookie's People

Contributors

aldaronlau avatar laggykiller avatar mmvanheusden avatar shaybox avatar thewh1teagle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rookie's Issues

[Bug]: Firefox: Incomplete profiles.ini parsing

What happened?

On Firefox setups with an empty "Profile0" profile (happens when some other profile is the default):

PanicException: called `Result::unwrap()` on an `Err` value: cant find any brave cookies file

You have to parse the [Install...] section in the profiles.ini file and find out the actual profile to use. Ideally one could optionally select a specific profile.

See here:
n8henrie/pycookiecheat@1e609f3#diff-ad7e90379c804b2614f8dc3d28249a1dd014408fffcc78a1f501b1f454ba68efR54-R89

Steps to reproduce

  1. Create a new, pristine, Firefox profiles directory
  2. firefox --ProfileManager
  3. Create a second profile and make it default.
  4. Open Firefox, open google.com. Cookies are stored.
  5. Then:
~ โฏ python -m venv .test
~ โฏ .test/bin/pip install rookiepy
Collecting rookiepy
  Obtaining dependency information for rookiepy from https://files.pythonhosted.org/packages/48/51/09a1ae45a89414a9d5c41017dd41633cfe218211e1e3e05db5ccc6814d4e/rookiepy-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Downloading rookiepy-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (599 bytes)
Downloading rookiepy-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB)
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 3.7/3.7 MB 5.4 MB/s eta 0:00:00
Installing collected packages: rookiepy
Successfully installed rookiepy-0.3.3

~ โฏ .test/bin/pip install ipython
[...]
~ โฏ .test/bin/ipython
Python 3.11.6 (main, Nov 14 2023, 09:36:21) [GCC 13.2.1 20230801]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import rookiepy

In [2]: cookies = rookiepy.firefox(["google.com"])
thread '<unnamed>' panicked at bindings/python/src/lib.rs:33:44:
called `Result::unwrap()` on an `Err` value: cant find any brave cookies file
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---------------------------------------------------------------------------
PanicException                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 cookies = rookiepy.firefox(["google.com"])

PanicException: called `Result::unwrap()` on an `Err` value: cant find any brave cookies file

What browsers are you seeing the problem on?

Firefox

Relevant log output

No response

cant decrypt value

Unfortunately, apparently this lib is also broken and does not work with chrome because decrypt.

Trace:

cookies = rookiepy.chrome()
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "cant decrypt value"', src/lib.rs:85:43
...
PanicException: called `Result::unwrap()` on an `Err` value: "cant decrypt value"

Arch Linux, google-chrome (Stable Channel) 117.0.5938.132-1 (from aur)

Can i hide the rust panic message?

Hi, I'm using the python bindings for this library and so far so good, it's great. My only issue is that when I'm calling a method like opera when i don't have opera installed it gives out a rust panic exception.

thread '<unnamed>' panicked at bindings/python/src/lib.rs:70:42:
called `Result::unwrap()` on an `Err` value: can't find any cookies file
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is alright, given that the browser couldn't be found, the problem is that i can't seem to catch this exception. When this happens this error gets printed out no matter what. I'm just making sure this is to be expected, and if it is, i would really like a way to avoid printing the error.

By the way, I'm using Linux and the library is version 0.4.0

Also sorry for the mess that is this issue, i've been second-guessing myself a lot.

Thanks for your patience.

[Bug]: Inability to Decrypt Cookies in Octo Browser

What happened?

Hello @thewh1teagle, once again, thank you very much for adding Octo Browser to the software, but in this issue, I would like to make some recommendations regarding fixes.

Firstly, the octo_browser(domains: Option<Vec<&str>>) function besides the domains argument must necessarily contain additional arguments: cookies_path, key_path because Octo Browser generates a new folder (under a random name) in the directory C:\Users\username\AppData\Roaming\Octo Browser\tmp every time the profile is launched, where browser files, including cookies and others, are located. Therefore, calling find_chrome_based_paths() in the octo_browser() function doesn't make sense.

Secondly, for some reason, attempting to decrypt cookies with the "encrypted_key" key, which is located in the "Local State" file, results in the error "can't decrypt using key." Although the "encrypted_key" keys of Octo Browser and Google Chrome seem to be identical. The values of "encrypted_value" in the table also seem to be encrypted with the same algorithm as in Google Chrome. In general, everything seems to be the same, but for some reason, it is not possible to decrypt the cookie using the aforementioned key.

Below, I am attaching two files, "Cookies" and "Local State," which Octo Browser uses. Perhaps, in your free time, you could take a look and figure out what's going on, why it's not possible to decrypt the cookie values.

Local State.txt
Cookies.txt

P.S.: I changed the file extension for the "Cookies" file to .txt because GitHub does not allow uploading files with extensions like .sqlite3, etc.

Steps to reproduce

  1. Open Octo Browser (Chromium based).
  2. Attempt to decrypt the cookies using the "encrypted_key" key from the "Local State" file.
  3. Observe the error message: "can't decrypt using key."
  4. Note that the "encrypted_key" keys of Octo Browser and Google Chrome appear identical, and the values of "encrypted_value" in the "Cookies" file seem to be encrypted with the same algorithm as in Google Chrome.
  5. Despite the similarities, the cookies cannot be decrypted using the provided key.

What browsers are you seeing the problem on?

Chromium

Relevant log output

No response

Retrieving session cookies expires them

Hello,

When using rookiepy to retrieve the sessionid cookie for a website, it directly expires the session, so I can't use it to login with my script. I use Microsoft Edge and the cookie expires when I use load() or edge() methods, even if I don't use the cookie in a request.

Is it a problem with rookiepy or with the website I'm trying to connect ? It's weird because with browser_cookie3, before the chromium update, it worked perfectly.

Thanks

[Feature Request]: Dealing with cookies with "Session" expiry

Describe the feature

At this time, I have observed in Chrome, 118.0.5993.71 at the very least, that cookies set as Expiry=Session do what they say on the tin: they are not stored within the database file at anytime.

I am fairly certain this is a unsolvable problem within the confines of the "reading the Cookies database file" solution that this project and those like it rely on to provide functionality, however, I think it would be worth opening at issue on this, if for no other reason than to direct future users to this, as this will certainly become a regularly-asked question. I have yet to see mention of this fundamental gap in functionality mentioned for this project in the documentation, much to the dismay of those who embark on using this code to solve their problem, only to find their one problem cannot be solved by these means.

For said future developers with this problem: my one recommendation to you is to write a browser extension to read the cookie when it is sent by the server, if there is no other option (like submitting a login form instead, which I suppose you've already considered by now).

If you don't think this issue will have any benefit to you/this project, feel free to close it, no hard feelings. :)

[Bug]: It doesn't work correctly with Octo Browser

What happened?

Hello, really grateful for your software, it's saved me a lot of time. However, there's a minor issue โ€“ it doesn't work properly with Octo Browser (https://octobrowser.net/). I've come up with a quick fix that addresses this problem, but I've never worked with Rust before, and I'd appreciate if you (the author) could resolve this bug related to cookie unloading via Python bindings from Octo Browser. Here's the link to my commit that resolves this issue with Octo Browser (Chromium): igorank@859f6d7

Steps to reproduce

  1. call function: rookiepy.any_browser(db_path=db_path, key_path=key_path, domains=None)
  2. Unlocking chrome database, it may take a while (sometimes up to minute)
    thread '' panicked at rookie-rs\src\browser\chromium.rs:89:36:
    range end index 3 out of range for slice of length 1
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
    Exception in thread Thread-1:
    File "C:\Users\work\Documents\Projects\fb-multi-tasker\cookie_manager.py", line 15, in _load_cookies_from_db
    cookies = rookiepy.any_browser(db_path=db_path, key_path=key_path, domains=None)
    pyo3_runtime.PanicException: range end index 3 out of range for slice of length 1

What browsers are you seeing the problem on?

Chromium

Relevant log output

Unlocking chrome database, it may take a while (sometimes up to minute)
thread '<unnamed>' panicked at rookie-rs\src\browser\chromium.rs:89:36:
range end index 3 out of range for slice of length 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Exception in thread Thread-1:
File "C:\Users\work\Documents\Projects\fb-multi-tasker\cookie_manager.py", line 15, in _load_cookies_from_db
    cookies = rookiepy.any_browser(db_path=db_path, key_path=key_path, domains=None)
pyo3_runtime.PanicException: range end index 3 out of range for slice of length 1

python 3.12 wheels on windows and macOS

It seems like python 3.12 wheels are only available for linux: https://pypi.org/project/rookiepy/#files

Is it possible to provide python 3.12 wheels on windows and macOS? Thanks.


Edit:

Seems like python3.12 was not present on the runner for the latest release: https://github.com/thewh1teagle/rookie/actions/runs/6435145142/job/17475799007#step:4:247

Github runner image with python 3.12 is still prerelease (https://github.com/actions/runner-images/releases/tag/win22%2F20231005.1), so your runner did not have python3.12 on it

You can wait about 1 week for github runner with python 3.12 to be released and fully rolled out (https://github.com/actions/runner-images#available-images), by then python 3.12 wheels should be built the next time you run github action without further modifications, or you can modify github action to do this without further waiting:

- name: Set up Python 3.12
  uses: actions/setup-python@v4
  with:
    python-version: "3.12"
    allow-prereleases: true

[Bug]: microsoft-edge-dev cookie file path should be dev instead of Dev?

What happened?

Hello,
I just found rookiepy says cannot find my microsoft edge browser's cookie. Then I digged a little bit and found it's searching for cookie file in ~/.config/microsoft-edge-Dev, but the edge browser (installed by Archlinux AUR package microsoft-edge-dev-bin) is using lower case dev, i.e ~/.config/microsoft-edge-dev.

After I created a synmbolic link microsoft-edge-Dev to microsoft-edge-dev, it's working greatly now.

Not sure if it's a bug worth fixing, just list it here in case other people met same issue.
Thanks for this nice package BTW.

Steps to reproduce

Archlinux, install AUR package microsoft-edge-dev-bin.
Run msedge, and double check ~/.config/microsoft-edge-dev is created.
use rookiepy to extract edge cookie, it reports error:

thread '<unnamed>' panicked at bindings/python/src/lib.rs:67:41:                                                                                                                              called `Result::unwrap()` on an `Err` value: can't find any cookies file                                                                                                                      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<string>", line 1, in <module>                                                         
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: can't find any cookies file

What browsers are you seeing the problem on?

Edge

Relevant log output

thread '<unnamed>' panicked at bindings/python/src/lib.rs:67:41:                                                                                                                              called `Result::unwrap()` on an `Err` value: can't find any cookies file                                                                                                                      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<string>", line 1, in <module>                                                         
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: can't find any cookies file

[Bug]: panicked at macos

What happened?

RUST_BACKTRACE=1 cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
Running target/debug/cookie_helper
thread 'main' panicked at 'called Result::unwrap() on an Err value: decrypt_encrypted_value failed', src/main.rs:5:56
stack backtrace:
0: rust_begin_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
1: core::panicking::panic_fmt
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
2: core::result::unwrap_failed
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
3: core::result::Result<T,E>::unwrap
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1076:23
4: cookie_helper::main
at ./src/main.rs:5:32
5: core::ops::function::FnOnce::call_once
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Steps to reproduce

use rookie::{self, common::enums::Cookie};

fn main() {
let domains = Some(vec!["google.com"]); // set to None to get all
let cookies: Vec = rookie::chrome(domains).unwrap();
println!("{cookies:?}");
}
1.cargo run

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

[Feature Request]: Error size cannot be known at compilation time.

Describe the feature

Currently the Error type used is Box<dyn Error> which cannot be known at compilation time, which prevents using the ? operator within a method that returns Result.

Using a crate such as thiserror or even anyhow if you'd rather not have strict Error types would solve this and make using this library easier.

error[E0277]: the size for values of type `dyn std::error::Error` cannot be known at compilation time
  --> src\lib.rs:29:44
   |
29 |         let cookies = rookie::load(domains)?;
   |                                            ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `dyn std::error::Error`
   = help: the following other types implement trait `FromResidual<R>`:
             <Result<T, F> as FromResidual<Yeet<E>>>
             <Result<T, F> as FromResidual<Result<Infallible, E>>>
   = note: required for `Box<dyn std::error::Error>` to implement `std::error::Error`
   = note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
   = note: required for `Result<SpotifyLyrics, anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`

error[E0277]: `dyn std::error::Error` cannot be sent between threads safely
   --> src\lib.rs:29:44
    |
29  |         let cookies = rookie::load(domains)?;
    |                                            ^ `dyn std::error::Error` cannot be sent between threads safely
    |
    = help: the trait `Send` is not implemented for `dyn std::error::Error`
    = help: the following other types implement trait `FromResidual<R>`:
              <Result<T, F> as FromResidual<Yeet<E>>>
              <Result<T, F> as FromResidual<Result<Infallible, E>>>
    = note: required for `Unique<dyn std::error::Error>` to implement `Send`
note: required because it appears within the type `Box<dyn Error>`
   --> C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\boxed.rs:195:12
    |
195 | pub struct Box<
    |            ^^^
    = note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
    = note: required for `Result<SpotifyLyrics, anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`

error[E0277]: `dyn std::error::Error` cannot be shared between threads safely
   --> src\lib.rs:29:44
    |
29  |         let cookies = rookie::load(domains)?;
    |                                            ^ `dyn std::error::Error` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `dyn std::error::Error`
    = help: the following other types implement trait `FromResidual<R>`:
              <Result<T, F> as FromResidual<Yeet<E>>>
              <Result<T, F> as FromResidual<Result<Infallible, E>>>
    = note: required for `Unique<dyn std::error::Error>` to implement `Sync`
note: required because it appears within the type `Box<dyn Error>`
   --> C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\alloc\src\boxed.rs:195:12
    |
195 | pub struct Box<
    |            ^^^
    = note: required for `anyhow::Error` to implement `From<Box<dyn std::error::Error>>`
    = note: required for `Result<SpotifyLyrics, anyhow::Error>` to implement `FromResidual<Result<Infallible, Box<dyn std::error::Error>>>`

For more information about this error, try `rustc --explain E0277`.

[Bug]: Panic with chrome 'range end index 3 out of range for slice of length 0'

What happened?

Got a stacktrace on Windows 10 with chrome Version 123.0.6312.58.
Only if I'm getting cookies without a list of domains:
PanicException: range end index 3 out of range for slice of length 0

Works when setting a domain list and works on Firefox and Edge without domains.

Steps to reproduce

  1. Run any load function for chrome with no parameters rookiepy.chrome()

What browsers are you seeing the problem on?

Chrome

Relevant log output

DEBUG:rookie.common.paths:Found mozilla path C:\Users\X243276\AppData\Roaming\Mozilla\Firefox\Profiles/qf1j0fau.default-release\cookies.sqlite
DEBUG:rookie.common.paths:Found chrome path C:\Users\X243276\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies, C:\Users\X243276\AppData\Local\Microsoft\Edge\User Data\Default\Network\../../Local State
WARNING:rookie.browser.chromium:Unlocking chrome database, it may take a while (sometimes up to minute)
INFO:rookie.browser.chromium:Creating sqlite connection to C:\Users\X243276\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies
DEBUG:rookie.common.paths:Found chrome path C:\Users\X243276\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies, C:\Users\X243276\AppData\Local\Google\Chrome\User Data\Default\Network\../../Local State
WARNING:rookie.browser.chromium:Unlocking chrome database, it may take a while (sometimes up to minute)
INFO:rookie.browser.chromium:Creating sqlite connection to C:\Users\X243276\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies
thread '<unnamed>' panicked at rookie-rs\src\browser\chromium.rs:98:36:
range end index 3 out of range for slice of length 0
stack backtrace:
   0:     0x7ffdc0d00c3a - PyInit_rookiepy
   1:     0x7ffdc0d12f9b - PyInit_rookiepy
   2:     0x7ffdc0cfd991 - PyInit_rookiepy
   3:     0x7ffdc0d009ba - PyInit_rookiepy
   4:     0x7ffdc0d02d2a - PyInit_rookiepy
   5:     0x7ffdc0d02998 - PyInit_rookiepy
   6:     0x7ffdc0d033d8 - PyInit_rookiepy
   7:     0x7ffdc0d032bd - PyInit_rookiepy
   8:     0x7ffdc0d01629 - PyInit_rookiepy
   9:     0x7ffdc0d02fd0 - PyInit_rookiepy
  10:     0x7ffdc0eb2487 - PyInit_rookiepy
  11:     0x7ffdc0eb2a04 - PyInit_rookiepy
  12:     0x7ffdc0bdd231 - PyInit_rookiepy
  13:     0x7ffdc0bd8f80 - PyInit_rookiepy
  14:     0x7ffdc0bd9a12 - PyInit_rookiepy
  15:     0x7ffdc0bc4c82 - <unknown>
  16:     0x7ffdc0bc60f9 - <unknown>
  17:     0x7ffdc0bc1274 - <unknown>
  18:     0x7ffdc0bc4b80 - <unknown>
  19:     0x7ffdbe4a6cec - PyUnicode_RichCompare
  20:     0x7ffdbe45910b - PyObject_Vectorcall
  21:     0x7ffdbe45a544 - PyEval_EvalFrameDefault
  22:     0x7ffdbe46fa77 - PyMapping_Check
  23:     0x7ffdbe46f137 - PyEval_EvalCode
  24:     0x7ffdbe46d80a - PyMapping_Items
  25:     0x7ffdbe46d786 - PyMapping_Items
  26:     0x7ffdbe5ba17e - PyThread_tss_is_created
  27:     0x7ffdbe4233a5 - PyRun_SimpleFileObject
  28:     0x7ffdbe51a620 - PyRun_AnyFileObject
  29:     0x7ffdbe51aaef - Py_MakePendingCalls
  30:     0x7ffdbe51ab5f - Py_MakePendingCalls
  31:     0x7ffdbe51b964 - Py_RunMain
  32:     0x7ffdbe51b7f5 - Py_RunMain
  33:     0x7ffdbe4660d9 - Py_Main
  34:     0x7ff6a5ce1230 - <unknown>
  35:     0x7ffe22847344 - <unknown>
  36:     0x7ffe231e26b1 - RtlUserThreadStart
Traceback (most recent call last):
  File "C:\Users\X243276\projects\viviane-core\admin-sdk\cookies.py", line 99, in <module>
    cookies = rookiepy.load()
              ^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: range end index 3 out of range for slice of length 0

[Bug]: Chrome config additional profiles may have "Cookies" filename instead of "Cookie"

What happened?

In config.rs, the Chrome config data_paths list is lacking additional patterns,

"%LOCALAPPDATA%/Google/Chrome{channel}/User Data/Profile */Network/Cookies", /*notice the s at the end*/
...
"%APPDATA%/Google/Chrome{channel}/User Data/Profile */Network/Cookies"

I have witnessed first-hand this file being created instead of Cookie for Chrome 118.0.5993.71 with a signed-in google account attached. I would consider this a bug over a feature request because all the rest of the Chromium-based browser configs have it already. I can submit a PR if you want it, but the solution in this case is so trivial I don't think its worth the extra effort rather than rolling this fix into the next update.

Steps to reproduce

  1. Install Chrome 118.0.5993.71
  2. Sign the browser into a new Google account
  3. A new Profile directory is created, i.e. Profile n/
  4. Check the cookie database name, Cookies instead of Cookie under Profile n/Network/.

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Incorrect expiry times

Consider the following python script (using v0.2.7):

import browser_cookie3, rookiepy

print('browser_cookie3:')
for c in browser_cookie3.firefox(domain_name='test.wikipedia.org'):
    print(c.name, c.expires)

print('\nrookiepy:')
for c in rookiepy.firefox(['test.wikipedia.org']):
    print(c.name, c.expires)

prints the following:

browser_cookie3:
testwikiss0-UserID 1728238484
testwikiUserID 1728238484
testwikiss0-UserName 1728238484
testwikiUserName 1728238484
WMF-Last-Access 1699444800
WMF-DP 1696723200
NetworkProbeLimit 1696706087
testwikiSession None
ss0-testwikiSession None
testwikimwuser-sessionId None

rookiepy:
testwikiss0-UserID 1728238484000
testwikiUserID 1728238484000
testwikiss0-UserName 1728238484000
testwikiUserName 1728238484000
WMF-Last-Access 1699444800000
WMF-DP 1696723200000
NetworkProbeLimit 1696706087000
testwikiSession 2012062492654
ss0-testwikiSession 2012062492654
testwikimwuser-sessionId 2012062492654

Note that expiry values returned by rookiepy are 1000 times greater than the ones in browser_cookie3. (they are in milliseconds instead of the expected seconds)

Also, for the last three items, rookiepy has returned 2012062492654 instead of None. This currently does not cause issue, because it is in milliseconds, but if we convert values to second then the cookie is expired.

Some cookies are missing(?)

import browser_cookie3, rookiepy

print(f'{len(rookiepy.firefox())=}')
print(f'{len(browser_cookie3.firefox())=}')

print(len(rookiepy.firefox(['google.com'])))
print(len(browser_cookie3.firefox(domain_name='google.com')))

On my Windows 10 system the above scripts prints:

len(rookiepy.firefox())=675
len(browser_cookie3.firefox())=7104
47
51

Not sure if my method of comparison above is correct, but it looks to me that browser_cookie3 is able to find more cookies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.