From b785a7f21cad21de039d020390a4b4329029a921 Mon Sep 17 00:00:00 2001 From: oopsbagel Date: Mon, 17 Mar 2025 16:23:18 -0700 Subject: [PATCH] feat(qmdl): add rayhunter version and os to manifest.toml --- Cargo.lock | 1 + bin/Cargo.toml | 1 + bin/src/qmdl_store.rs | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d00e863..d3b621a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1717,6 +1717,7 @@ dependencies = [ "include_dir", "log", "mime_guess", + "nix", "rayhunter", "serde", "serde_json", diff --git a/bin/Cargo.toml b/bin/Cargo.toml index 28d4e97..8145144 100644 --- a/bin/Cargo.toml +++ b/bin/Cargo.toml @@ -33,3 +33,4 @@ serde_json = "1.0.114" image = "0.25.1" tempfile = "3.10.1" simple_logger = "5.0.0" +nix = { version = "0.29.0", features = ["feature"] } \ No newline at end of file diff --git a/bin/src/qmdl_store.rs b/bin/src/qmdl_store.rs index 11c6eda..e8c48ca 100644 --- a/bin/src/qmdl_store.rs +++ b/bin/src/qmdl_store.rs @@ -1,5 +1,7 @@ use chrono::{DateTime, Local}; +use nix::sys::utsname::uname; use serde::{Deserialize, Serialize}; +use std::env::consts::OS; use std::path::{Path, PathBuf}; use thiserror::Error; use tokio::{ @@ -43,17 +45,29 @@ pub struct ManifestEntry { pub last_message_time: Option>, pub qmdl_size_bytes: usize, pub analysis_size_bytes: usize, + pub rayhunter_version: Option, + pub rayhunter_os: Option, } impl ManifestEntry { fn new() -> Self { let now = Local::now(); + let operating_system = match uname() { + Ok(utsname) => format!( + "{} {}", + utsname.sysname().to_string_lossy(), + utsname.release().to_string_lossy() + ), + Err(_) => OS.to_owned(), + }; ManifestEntry { name: format!("{}", now.timestamp()), start_time: now, last_message_time: None, qmdl_size_bytes: 0, analysis_size_bytes: 0, + rayhunter_version: Some(env!("CARGO_PKG_VERSION").to_owned()), + rayhunter_os: Some(operating_system), } }