Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions implants/lib/eldritch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ listeners = { workspace = true }
transport = { workspace = true, features = ["mock"] }
httptest = { workspace = true }
uuid = { workspace = true, features = ["v4"] }
lazy_static = "1.5.0"

# BUILD
[build-dependencies]
Expand Down
13 changes: 13 additions & 0 deletions implants/lib/eldritch/src/sys/exec_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,16 @@ fn handle_exec(
mod tests {
use std::{fs, path::Path, process, thread, time};

use lazy_static::lazy_static;
use std::sync::Mutex;
use sysinfo::{PidExt, ProcessExt, System, SystemExt};
use tempfile::NamedTempFile;

lazy_static! {
// Mutex to serialize tests that check for zombie processes to prevent interference
static ref ZOMBIE_TEST_MUTEX: Mutex<()> = Mutex::new(());
}

fn init_logging() {
let _ = pretty_env_logger::formatted_timed_builder()
.filter_level(log::LevelFilter::Info)
Expand Down Expand Up @@ -239,6 +246,9 @@ mod tests {

#[test]
fn test_sys_exec_disown_linux() -> anyhow::Result<()> {
// Acquire mutex to ensure exclusive access to process table/zombie checks
let _guard = ZOMBIE_TEST_MUTEX.lock().unwrap();

if cfg!(target_os = "linux")
|| cfg!(target_os = "ios")
|| cfg!(target_os = "macos")
Expand Down Expand Up @@ -269,6 +279,9 @@ mod tests {

#[test]
fn test_sys_exec_disown_no_defunct() -> anyhow::Result<()> {
// Acquire mutex to ensure exclusive access to process table/zombie checks
let _guard = ZOMBIE_TEST_MUTEX.lock().unwrap();

init_logging();

if cfg!(target_os = "linux")
Expand Down
8 changes: 8 additions & 0 deletions test_output.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
npm error code ENOENT
npm error syscall open
npm error path /app/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/app/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /home/jules/.npm/_logs/2026-01-06T08_28_56_438Z-debug-0.log
Loading