Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/entire rookie #31

Merged
merged 11 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"editor.formatOnSave": true,
"editor.tabSize": 2,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
"editor.defaultFormatter": "rust-lang.rust-analyzer",
},
"rust-analyzer.checkOnSave": true,
"rust-analyzer.check.command": "clippy"
}
6 changes: 6 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Build rookie

## Linux setup

```console
sudo apt-get install -y python3-dev
```

## rookie-rs

```console
Expand Down
7 changes: 0 additions & 7 deletions bindings/README.md

This file was deleted.

8 changes: 3 additions & 5 deletions bindings/python/src/browsers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::to_dict;
use pyo3::prelude::*;
use rookie::browser;
use std::path::PathBuf;

/// Any browser
Expand Down Expand Up @@ -102,7 +101,7 @@ pub fn firefox_based(
db_path: String,
domains: Option<Vec<&str>>,
) -> PyResult<Vec<PyObject>> {
let cookies = browser::mozilla::firefox_based(PathBuf::from(db_path), domains)?;
let cookies = rookie::firefox_based(PathBuf::from(db_path), domains)?;
let cookies = to_dict(py, cookies)?;

Ok(cookies)
Expand Down Expand Up @@ -144,8 +143,7 @@ pub fn chromium_based(
db_path: String,
domains: Option<Vec<&str>>,
) -> PyResult<Vec<PyObject>> {
let cookies =
browser::chromium::chromium_based(PathBuf::from(key_path), PathBuf::from(db_path), domains)?;
let cookies = rookie::chromium_based(PathBuf::from(key_path), PathBuf::from(db_path), domains)?;
let cookies = to_dict(py, cookies)?;

Ok(cookies)
Expand Down Expand Up @@ -181,7 +179,7 @@ pub fn chromium_based(
osx_key_service: None,
osx_key_user: None,
};
let cookies = browser::chromium::chromium_based(&config, PathBuf::from(db_path), domains)?;
let cookies = rookie::chromium_based(&config, PathBuf::from(db_path), domains)?;
let cookies = to_dict(py, cookies)?;

Ok(cookies)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pyo3::{prelude::*, types::PyDict};
use rookie::common::enums::Cookie;
use rookie::enums::Cookie;
mod browsers;
use browsers::*;

Expand Down
12 changes: 8 additions & 4 deletions docs/General.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

## Password prompt

This library may trigger a password prompt with kde-wallet on linux / macOS with chromium based browsers when accessing browser cookies.
This library may trigger a password prompt with kde-wallet on linux / macOS with chromium based browsers when accessing browser cookies.

## Session Cookies Retrieval

Chrome-based browsers have a security feature that prevents external access to their cookies file. To bypass this security measure, we restart the browser seamlessly. As a result, session cookies are retrieved and can be used, but they will expire once the browser is closed again.

## MacOS Safari permission denied

On recent versions of macOS the path of the cookies at `/Users/user/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies` has restricted access.
You can grant full disk access through `System Settings` -> Search for `Full disk access` -> And enable it for terminal / the app you running from.

## Using on Unsupported platforms

Expand All @@ -28,7 +32,7 @@ And pull the Cookies file you want and then execute `CLI` on that file

To import cookies from rookiepy into the browser,

you can execute short javascript code in the browser console
you can execute short javascript code in the browser console

and construct the cookies manually,

Expand Down Expand Up @@ -58,6 +62,6 @@ print(create_js_code(cookies))

In this example, I extracted the cookies from the `Brave` browser from the domain 'github.com.'

I cleared all of my browser cookies, executed the code, copied the output.
I cleared all of my browser cookies, executed the code, copied the output.

Then, I opened `github.com` in the browser and pasted it into the console. As a result, I was logged in into my account.
Then, I opened `github.com` in the browser and pasted it into the console. As a result, I was logged in into my account.
4 changes: 0 additions & 4 deletions rookie-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ keywords = ["windows", "cookies", "rust", "web"]
name = "rookie"
path = "src/lib.rs"

[[bin]]
name = "main"
path = "bin/main.rs"

[dependencies]
aes = "0.8"
aes-gcm = "0.10"
byteorder = "1"
cbc = "0.1"
cfg-if = "1"
eyre = { version = "0.6.12", features = ["pyo3"] }
glob = "0.3"
log = "0.4"
Expand Down
4 changes: 0 additions & 4 deletions rookie-rs/bin/main.rs

This file was deleted.

10 changes: 0 additions & 10 deletions rookie-rs/examples/chrome/Cargo.toml

This file was deleted.

4 changes: 0 additions & 4 deletions rookie-rs/examples/chrome/src/main.rs

This file was deleted.

4 changes: 4 additions & 0 deletions rookie-rs/examples/simple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
let cookies = rookie::brave(None).unwrap();
println!("{cookies:?}");
}
Loading
Loading