feat(qmdl): add rayhunter version and os to manifest.toml

This commit is contained in:
oopsbagel
2025-03-17 16:23:18 -07:00
committed by Will Greenberg
parent 09d35ccec7
commit b785a7f21c
3 changed files with 16 additions and 0 deletions
Generated
+1
View File
@@ -1717,6 +1717,7 @@ dependencies = [
"include_dir",
"log",
"mime_guess",
"nix",
"rayhunter",
"serde",
"serde_json",
+1
View File
@@ -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"] }
+14
View File
@@ -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<DateTime<Local>>,
pub qmdl_size_bytes: usize,
pub analysis_size_bytes: usize,
pub rayhunter_version: Option<String>,
pub rayhunter_os: Option<String>,
}
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),
}
}