-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23e8d2f
commit 967bc2a
Showing
4 changed files
with
94 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use rookie; | ||
|
||
fn main() { | ||
let cookies = rookie::chrome(None).unwrap(); | ||
let cookies = rookie::firefox(None).unwrap(); | ||
println!("{:?}", cookies); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#[cfg(target_os = "windows")] | ||
pub const CHROME_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Google/Chrome/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "windows")] | ||
pub const BRAVE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/BraveSoftware/Brave-Browser/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "windows")] | ||
pub const EDGE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Microsoft/Edge/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "windows")] | ||
pub const FIREFOX_PATHS: &'static [&'static str] = &[ | ||
"%APPDATA%/Mozilla/Firefox" | ||
]; | ||
|
||
|
||
|
||
#[cfg(target_os = "linux")] | ||
pub const CHROME_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Google/Chrome/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "linux")] | ||
pub const BRAVE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/BraveSoftware/Brave-Browser/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "linux")] | ||
pub const EDGE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Microsoft/Edge/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "linux")] | ||
pub const FIREFOX_PATHS: &'static [&'static str] = &[ | ||
"~/snap/firefox/common/.mozilla/firefox", | ||
"~/.mozilla/firefox" | ||
]; | ||
|
||
|
||
|
||
#[cfg(target_os = "macos")] | ||
pub const CHROME_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Google/Chrome/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "macos")] | ||
pub const BRAVE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/BraveSoftware/Brave-Browser/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "macos")] | ||
pub const EDGE_PATHS: &'static [&'static str] = &[ | ||
"%LOCALAPPDATA%/Microsoft/Edge/User Data" | ||
]; | ||
|
||
#[cfg(target_os = "macos")] | ||
pub const FIREFOX_PATHS: &'static [&'static str] = &[ | ||
"~/Library/Application Support/Firefox" | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
pub mod enums; | ||
mod chromium; | ||
use std::error::Error; | ||
|
||
#[cfg(target_os = "windows")] | ||
mod winapi; | ||
|
||
mod chromium; | ||
mod paths; | ||
mod sqlite; | ||
mod mozilla; | ||
mod utils; | ||
use std::error::Error; | ||
|
||
mod enums; | ||
mod constants; | ||
pub use chromium::chromium_based; | ||
pub use mozilla::firefox_based; | ||
pub use enums::*; | ||
|
||
|
||
|
||
pub fn firefox(domains: Option<Vec<&str>>) -> Result<Vec<Cookie>, Box<dyn Error>> { | ||
let db_path = paths::find_firefox_paths()?; | ||
let db_path = paths::find_mozilla_based_paths(constants::FIREFOX_PATHS)?; | ||
firefox_based(db_path, domains) | ||
} | ||
|
||
pub fn chrome(domains: Option<Vec<&str>>) -> Result<Vec<Cookie>, Box<dyn Error>> { | ||
let (key, db_path) = paths::find_chrome_paths()?; | ||
let (key, db_path) = paths::find_chrome_based_paths(constants::CHROME_PATHS)?; | ||
chromium_based(key, db_path, domains) | ||
} | ||
|
||
|
||
pub fn brave(domains: Option<Vec<&str>>) -> Result<Vec<Cookie>, Box<dyn Error>> { | ||
let (key, db_path) = paths::find_brave_paths()?; | ||
let (key, db_path) = paths::find_chrome_based_paths(constants::BRAVE_PATHS)?; | ||
chromium_based(key, db_path, domains) | ||
} | ||
|
||
pub fn edge(domains: Option<Vec<&str>>) -> Result<Vec<Cookie>, Box<dyn Error>> { | ||
let (key, db_path) = paths::find_edge_paths()?; | ||
let (key, db_path) = paths::find_chrome_based_paths(constants::EDGE_PATHS)?; | ||
chromium_based(key, db_path, domains) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters