diff --git a/TODO.md b/TODO.md index 55d4c2a..d00a92f 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,7 @@ ### Topology - Move server and client components into their own cargo projects +- Write wire protocol spec: `PROTOCOL.md` or doc comment in the protocol module. Spec the two-part frame format `[u32 header_len][rkyv PacketHeader][u32 payload_len][rkyv payload]` with `PacketHeader { dst_path, src_path, packet_type }`. Required before router and payload implementations can be written independently without diverging. See design doc: ~/.gstack/projects/astatin3-unshell/astatin3-main-design-20260420-223152.md ### Obfuscation - Implement custom ELF loading possibly using 'https://github.com/weizhiao/rust-dlopen' diff --git a/src/tree/log.rs b/src/tree/log.rs deleted file mode 100644 index 99faaa1..0000000 --- a/src/tree/log.rs +++ /dev/null @@ -1,59 +0,0 @@ -/// Implement logging for the manager -use crossbeam_channel::{Receiver, Sender}; -use serde_json::{Value, json}; - -use crate::{ - logger::{Logger, Record}, - tree::{Tree, TreeElement, symbols}, -}; - -struct LoggerTX(Sender); -struct LoggerRX(Receiver); - -impl Tree { - /// Initiate the unshell logger for the local binary, piped through the manager - /// This will allow access to the logs through the tree - pub fn init_logger(&mut self) { - // Create the logger through the TX element of the manager - - let (tx, rx) = crossbeam_channel::unbounded(); - let (tx, rx) = (LoggerTX(tx), LoggerRX(rx)); - - // Set the logger through unshell - crate::logger::set_logger_box(Box::new(tx)); - // Add the logger to the tree - self.add_element(symbols::LOGGER.to_string(), Box::new(rx)); - } -} - -impl Logger for LoggerTX { - fn log(&self, log: crate::logger::Record) { - // This will never panic if the program is operating properly - self.0.send(log).unwrap(); - } -} - -impl TreeElement for LoggerRX { - fn get_type(&self) -> Value { - json!(symbols::TYPE_QUEUE) - } - - fn send_message(&mut self, target: Value, message: Value) -> Value { - match (target, message) { - (Value::Null, Value::String(message)) => match message.as_ref() { - symbols::CMD_GET => { - if !self.0.is_empty() { - json!(self.0.recv().unwrap()) - } else { - json!(Value::Null) - } - } - symbols::CMD_GET_LENGTH => { - json!(self.0.len()) - } - _ => json!(symbols::ERR_INVALID_COMMAND), - }, - _ => json!(symbols::ERR_INVALID_CHILD), - } - } -} diff --git a/ush-obfuscate/src/proc_impl_switcher.rs b/ush-obfuscate/src/proc_impl_switcher.rs index 76cec0a..c727686 100644 --- a/ush-obfuscate/src/proc_impl_switcher.rs +++ b/ush-obfuscate/src/proc_impl_switcher.rs @@ -59,7 +59,7 @@ pub mod proc_impl { use syn::{LitStr, parse_macro_input}; passtrough!(xor, crate::obfuscate::xor); - delete!(junk_asm); + passtrough!(junk_asm, crate::obfuscate::junk_asm); passtrough!(sym, crate::symbolic_ref::sym_ref); passtrough!(sym_fn, crate::symbolic_ref::sym_ref_fn);