-
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
e7f30c2
commit 6297041
Showing
6 changed files
with
84 additions
and
12 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
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,5 @@ | ||
use rookie::chrome; | ||
fn main() { | ||
pretty_env_logger::init(); | ||
let cookies = chrome(None).unwrap(); | ||
let cookies = rookie::brave(None).unwrap(); | ||
println!("Found {} cookies", cookies.len()); | ||
} |
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,4 +1,4 @@ | ||
fn main() { | ||
let cookies = rookie::brave(None).unwrap(); | ||
println!("{cookies:?}"); | ||
println!("Found {} cookies!", cookies.len()); | ||
} |
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
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,3 +1,4 @@ | ||
pub mod config; | ||
pub(crate) mod dpapi; | ||
pub(crate) mod file_unlock; | ||
pub(crate) mod shadow_copy; |
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,44 @@ | ||
use eyre::{bail, Context, Result}; | ||
use privilege::user::privileged; | ||
use rand::distributions::Alphanumeric; | ||
use rand::{thread_rng, Rng}; | ||
use std::path::PathBuf; | ||
|
||
/// Create temp folder and return path | ||
pub fn temp_folder(prefix: &str, suffix: &str, rand_len: usize) -> Result<PathBuf> { | ||
let random_string: String = thread_rng() | ||
.sample_iter(&Alphanumeric) | ||
.take(rand_len) | ||
.map(char::from) // From link above, this is needed in later versions | ||
.collect(); | ||
let name = format!("{}{}{}", prefix, random_string, suffix); | ||
let tmp = std::env::temp_dir(); | ||
let temp_path = tmp.join(name); | ||
std::fs::create_dir(temp_path.clone())?; | ||
log::trace!("created dir {}", temp_path.clone().display()); | ||
Ok(temp_path) | ||
} | ||
|
||
/// dst should be directory | ||
pub fn shadow_copy(src: PathBuf, dst: PathBuf) -> Result<()> { | ||
if !src.exists() { | ||
bail!("Source file not exists: {}", src.clone().display()) | ||
} | ||
if !privileged() { | ||
bail!("No admin rights") | ||
} | ||
log::info!( | ||
"Creating shadow copy to cookies file from {} to {}", | ||
src.display(), | ||
dst.display() | ||
); | ||
rawcopy_rs_next::rawcopy(src.clone().to_str().unwrap(), dst.to_str().unwrap()) | ||
.map_err(|err| eyre::eyre!(Box::new(err))) | ||
.context(format!( | ||
"Can't shadow copy from {} to {}", | ||
src.display(), | ||
dst.display(), | ||
))?; | ||
|
||
Ok(()) | ||
} |