feat: show rayhunter version/os/arch in pcap, ndjson, qmdl manifest

Create a util mod to provide information about the rayhunter binary and
system.
This commit is contained in:
oopsbagel
2025-03-18 00:43:03 -07:00
committed by Will Greenberg
parent b785a7f21c
commit f2b5aa2743
7 changed files with 67 additions and 29 deletions

View File

@@ -1,7 +1,6 @@
use rayhunter::util::RayhunterMetadata;
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::{
@@ -52,22 +51,15 @@ pub struct ManifestEntry {
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(),
};
let metadata = RayhunterMetadata::new();
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),
rayhunter_version: Some(metadata.version),
rayhunter_os: Some(metadata.os),
}
}