2025-11-13 11:52:01 -07:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
use lazy_static::lazy_static;
|
2025-11-08 14:56:03 -07:00
|
|
|
use unshell_lib::{
|
|
|
|
|
ModuleError,
|
2025-11-12 17:39:11 -07:00
|
|
|
config::{PayloadConfig, RuntimeConfig},
|
2025-11-08 14:56:03 -07:00
|
|
|
module::{Manager, Module},
|
|
|
|
|
};
|
2025-11-13 11:52:01 -07:00
|
|
|
use unshell_obfuscate::{obs, symbol};
|
2025-11-06 00:01:46 -07:00
|
|
|
|
2025-11-05 22:59:01 -07:00
|
|
|
#[macro_use]
|
2025-11-09 12:34:52 -07:00
|
|
|
extern crate unshell_lib;
|
2025-11-05 15:17:31 -07:00
|
|
|
|
2025-11-24 08:45:44 -07:00
|
|
|
// The main and initial 'configuration' for a payload
|
2025-11-13 11:52:01 -07:00
|
|
|
lazy_static! {
|
|
|
|
|
static ref PAYLOAD_CONFIG: PayloadConfig = PayloadConfig {
|
|
|
|
|
id: symbol!("Test ID"),
|
|
|
|
|
components: unshell_lib::get_components(),
|
|
|
|
|
runtime_config: vec![RuntimeConfig {
|
2025-11-14 09:43:41 -07:00
|
|
|
parent_component: symbol!("client").to_string(),
|
|
|
|
|
name: symbol!("client runtime").to_string(),
|
|
|
|
|
config: HashMap::from([(symbol!("host").to_string(), obs!("localhost:1234"))]),
|
2025-11-13 11:52:01 -07:00
|
|
|
}],
|
|
|
|
|
};
|
|
|
|
|
}
|
2025-11-12 17:39:11 -07:00
|
|
|
|
2025-11-05 22:59:01 -07:00
|
|
|
fn main() {
|
2025-11-24 08:45:44 -07:00
|
|
|
// Init the logger
|
2025-11-14 09:43:41 -07:00
|
|
|
#[cfg(not(feature = "obfuscate"))]
|
2025-11-09 12:34:52 -07:00
|
|
|
unshell_lib::logger::PrettyLogger::init();
|
2025-11-05 15:17:31 -07:00
|
|
|
|
2025-11-11 11:00:28 -07:00
|
|
|
debug!("Initialized");
|
2025-11-05 15:17:31 -07:00
|
|
|
|
2025-11-05 22:59:01 -07:00
|
|
|
match || -> Result<(), ModuleError> {
|
2025-11-06 00:01:46 -07:00
|
|
|
let args = std::env::args();
|
|
|
|
|
|
2025-11-24 08:45:44 -07:00
|
|
|
// TEMPORARY, load the module paths from command line args.
|
2025-11-13 11:52:01 -07:00
|
|
|
let mut modules = Vec::new();
|
|
|
|
|
for arg in args.skip(1) {
|
|
|
|
|
debug!("Loading module: {}", arg);
|
|
|
|
|
modules.push(Module::new(&arg)?)
|
|
|
|
|
}
|
2025-11-12 17:39:11 -07:00
|
|
|
|
2025-11-24 08:45:44 -07:00
|
|
|
// Run the manager, this is blocking.
|
2025-11-13 11:52:01 -07:00
|
|
|
Manager::run(&PAYLOAD_CONFIG, modules);
|
2025-11-05 22:59:01 -07:00
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}() {
|
|
|
|
|
Ok(_) => {}
|
|
|
|
|
Err(e) => {
|
2025-11-11 11:00:28 -07:00
|
|
|
debug!("ERROR! {:?}", e);
|
2025-11-05 22:59:01 -07:00
|
|
|
}
|
2025-11-05 15:17:31 -07:00
|
|
|
}
|
|
|
|
|
}
|