From 11045522b8d523222b2486a71d2b2fae759658ab Mon Sep 17 00:00:00 2001 From: Michael Mikovsky <77305074+Astatin3@users.noreply.github.com> Date: Sun, 23 Nov 2025 22:40:06 -0700 Subject: [PATCH] Payload config, disable all logs feature --- unshell-cli/Cargo.lock | 9 ++++- unshell-cli/Cargo.toml | 2 +- unshell-cli/src/main.rs | 20 ++++++++-- unshell-lib/Cargo.toml | 5 ++- unshell-lib/src/client/client_runtime.rs | 2 +- unshell-lib/src/logger/macros.rs | 2 +- unshell-lib/src/logger/macros_disabled.rs | 45 +++++++++++++++++++++++ unshell-lib/src/logger/mod.rs | 6 +++ 8 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 unshell-lib/src/logger/macros_disabled.rs diff --git a/unshell-cli/Cargo.lock b/unshell-cli/Cargo.lock index 1c59947..dcb8e28 100644 --- a/unshell-cli/Cargo.lock +++ b/unshell-cli/Cargo.lock @@ -272,6 +272,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.177" @@ -465,8 +471,9 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unshell-cli" -version = "0.1.0" +version = "0.0.0" dependencies = [ + "lazy_static", "unshell-crypt", "unshell-lib", "unshell-obfuscate", diff --git a/unshell-cli/Cargo.toml b/unshell-cli/Cargo.toml index 68c97ea..cb4f362 100644 --- a/unshell-cli/Cargo.toml +++ b/unshell-cli/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "unshell-cli" -version = "0.1.0" edition = "2024" [dependencies] unshell-lib = {path = "../unshell-lib"} unshell-obfuscate = {path = "../unshell-obfuscate"} unshell-crypt = {path = "../unshell-crypt"} +lazy_static = "1.5.0" diff --git a/unshell-cli/src/main.rs b/unshell-cli/src/main.rs index 19e6ce2..620f2ac 100644 --- a/unshell-cli/src/main.rs +++ b/unshell-cli/src/main.rs @@ -1,9 +1,21 @@ -use std::io::{Write, stdin, stdout}; +use lazy_static::lazy_static; +use unshell_lib::{config::PayloadConfig, module::Manager}; +use unshell_obfuscate::symbol; -use unshell_lib::Announcement; +lazy_static! { + static ref PAYLOAD_CONFIG: PayloadConfig = PayloadConfig { + id: symbol!("Test ID"), + components: unshell_lib::get_components(), + runtime_config: vec![], + }; +} fn main() -> Result<(), Box> { - let mut serverruntime = unshell_lib::server::ListenerRuntime::new(); + unshell_lib::logger::PrettyLogger::init(); + + Manager::run(&PAYLOAD_CONFIG, Vec::new()); + + // let mut serverruntime = unshell_lib::server::ListenerRuntime::new(); // loop { // print!("> "); @@ -33,7 +45,7 @@ fn main() -> Result<(), Box> { // // println!("{:?}", args); // } - serverruntime.send(&Announcement::GetRuntimes)?; + // serverruntime.send(&Announcement::GetRuntimes)?; // let response = serverruntime. diff --git a/unshell-lib/Cargo.toml b/unshell-lib/Cargo.toml index 4febce4..298bc03 100644 --- a/unshell-lib/Cargo.toml +++ b/unshell-lib/Cargo.toml @@ -3,13 +3,14 @@ name = "unshell-lib" edition = "2024" [features] -default = ["client", "server"] +default = ["client", "server", "log_debug"] # Components client = [] server = [] -log_debug = [] +log = [] +log_debug = ["log"] obfuscate = ["unshell-obfuscate/obfuscate"] diff --git a/unshell-lib/src/client/client_runtime.rs b/unshell-lib/src/client/client_runtime.rs index b3aac52..07eb228 100644 --- a/unshell-lib/src/client/client_runtime.rs +++ b/unshell-lib/src/client/client_runtime.rs @@ -2,7 +2,7 @@ use std::{ io::Read, net::TcpStream, sync::{ - Arc, Mutex, + Arc, atomic::{AtomicBool, Ordering}, }, thread::{self, JoinHandle}, diff --git a/unshell-lib/src/logger/macros.rs b/unshell-lib/src/logger/macros.rs index 2f6922c..669984f 100644 --- a/unshell-lib/src/logger/macros.rs +++ b/unshell-lib/src/logger/macros.rs @@ -41,7 +41,7 @@ macro_rules! debug { }}; ($fmt:tt, $($arg:expr),*) => {{ let _ = $fmt; - let _ = ($($arg),*); + $(let _ = $arg;)* }}; } diff --git a/unshell-lib/src/logger/macros_disabled.rs b/unshell-lib/src/logger/macros_disabled.rs new file mode 100644 index 0000000..ab203ab --- /dev/null +++ b/unshell-lib/src/logger/macros_disabled.rs @@ -0,0 +1,45 @@ +// Macros that are used that just drop the inside variables + +#[macro_export] +macro_rules! debug { + ($fmt:tt) => {{ + let _ = $fmt; + }}; + ($fmt:tt, $($arg:expr),*) => {{ + let _ = $fmt; + $(let _ = $arg;)* + }}; +} + +#[macro_export] +macro_rules! info { + ($fmt:tt) => {{ + let _ = $fmt; + }}; + ($fmt:tt, $($arg:expr),*) => {{ + let _ = $fmt; + $(let _ = $arg;)* + }}; +} + +#[macro_export] +macro_rules! warn { + ($fmt:tt) => {{ + let _ = $fmt; + }}; + ($fmt:tt, $($arg:expr),*) => {{ + let _ = $fmt; + $(let _ = $arg;)* + }}; +} + +#[macro_export] +macro_rules! error { + ($fmt:tt) => {{ + let _ = $fmt; + }}; + ($fmt:tt, $($arg:expr),*) => {{ + let _ = $fmt; + $(let _ = $arg;)* + }}; +} diff --git a/unshell-lib/src/logger/mod.rs b/unshell-lib/src/logger/mod.rs index 042f816..b903931 100644 --- a/unshell-lib/src/logger/mod.rs +++ b/unshell-lib/src/logger/mod.rs @@ -1,4 +1,10 @@ +// Choose if the macros are enabled based on the feature setting +#[cfg(feature = "log")] pub mod macros; + +#[cfg(not(feature = "log"))] +pub mod macros_disabled; + mod pretty_logger; use std::time::SystemTime;