From 601d151fbe6012ef816c9791e6c77b22b963ba40 Mon Sep 17 00:00:00 2001 From: hulto <7121375+hulto@users.noreply.github.com> Date: Fri, 27 Feb 2026 03:10:55 +0000 Subject: [PATCH 1/2] gate off linux --- .../stdlib/eldritch-libreport/Cargo.toml | 1 + .../src/std/screenshot_impl.rs | 32 +++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/implants/lib/eldritch/stdlib/eldritch-libreport/Cargo.toml b/implants/lib/eldritch/stdlib/eldritch-libreport/Cargo.toml index 1ec8600d1..03d5ace31 100644 --- a/implants/lib/eldritch/stdlib/eldritch-libreport/Cargo.toml +++ b/implants/lib/eldritch/stdlib/eldritch-libreport/Cargo.toml @@ -10,6 +10,7 @@ eldritch-agent = { workspace = true, optional = true } pb = { workspace = true, optional = true } nix = { workspace = true, optional = true } spin = { version = "0.10.0", features = ["rwlock"] } +[target.'cfg(not(target_os = "linux"))'.dependencies] xcap = { workspace = true, optional = true } image = { version = "0.25", optional = true } diff --git a/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs b/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs index e6d5468ad..222dfe24d 100644 --- a/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs +++ b/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs @@ -1,14 +1,18 @@ -use alloc::format; -use alloc::string::{String, ToString}; -use alloc::sync::Arc; -use alloc::vec::Vec; use eldritch_agent::{Agent, Context}; -use image::ImageFormat; -use pb::c2::report_file_request; -use pb::{c2, eldritch}; -use std::io::Cursor; -use std::sync::Mutex; -use xcap::Monitor; +use alloc::sync::Arc; + +#[cfg(not(target_os = "linux"))] +use { + alloc::format, + alloc::string::{String, ToString}, + alloc::vec::Vec, + image::ImageFormat, + pb::c2::report_file_request, + pb::{c2, eldritch}, + std::io::Cursor, + std::sync::Mutex, + xcap::Monitor, +}; #[cfg(all(unix, feature = "stdlib"))] fn get_hostname() -> String { @@ -32,6 +36,14 @@ fn get_hostname() -> String { "unknown".to_string() } +#[cfg(target_os = "linux")] +pub fn screenshot(agent: Arc, context: Context) -> Result<(), String> { + return Err( + "This OS isn't supported by the screenshot function.\nOnly windows and mac systems are supported".to_string() + ); +} + +#[cfg(not(target_os = "linux"))] pub fn screenshot(agent: Arc, context: Context) -> Result<(), String> { let monitors = Monitor::all().map_err(|e| e.to_string())?; From 4b1a7a1861d434001a6d04c127e50016044d5583 Mon Sep 17 00:00:00 2001 From: hulto <7121375+hulto@users.noreply.github.com> Date: Fri, 27 Feb 2026 03:13:08 +0000 Subject: [PATCH 2/2] fmt --- .../stdlib/eldritch-libreport/src/std/screenshot_impl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs b/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs index 222dfe24d..9cfed8202 100644 --- a/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs +++ b/implants/lib/eldritch/stdlib/eldritch-libreport/src/std/screenshot_impl.rs @@ -1,5 +1,5 @@ -use eldritch_agent::{Agent, Context}; use alloc::sync::Arc; +use eldritch_agent::{Agent, Context}; #[cfg(not(target_os = "linux"))] use {