Fix formatting issues for CI/CD

This commit is contained in:
pandaadir05
2025-11-20 14:55:46 +02:00
parent bff5b05837
commit 27dffbd108
3 changed files with 21 additions and 12 deletions

View File

@@ -740,11 +740,11 @@ mod platform {
let protection = match info.protection {
0 => MemoryProtection::NoAccess,
1 => MemoryProtection::ReadOnly,
2 => MemoryProtection::ReadWrite, // Write implies read on most systems
2 => MemoryProtection::ReadWrite, // Write implies read on most systems
3 => MemoryProtection::ReadWrite,
4 => MemoryProtection::Execute,
5 => MemoryProtection::ReadExecute,
6 => MemoryProtection::ReadWriteExecute, // WX -> RWX
6 => MemoryProtection::ReadWriteExecute, // WX -> RWX
7 => MemoryProtection::ReadWriteExecute,
_ => MemoryProtection::NoAccess,
};

View File

@@ -168,7 +168,8 @@ mod tests {
let mut config = DetectionConfig::default();
config.hook_detection = false;
let mut engine = DetectionEngine::with_config(Some(config)).expect("Failed to create engine");
let mut engine =
DetectionEngine::with_config(Some(config)).expect("Failed to create engine");
let process = create_test_process();
let regions = vec![create_rwx_region()];
@@ -207,7 +208,11 @@ mod tests {
let result = engine.analyze_process(&process, &image_regions, None);
// IMAGE regions may trigger ML heuristics, but should not be flagged as Malicious
assert_ne!(result.threat_level, ThreatLevel::Malicious, "IMAGE region should not be malicious");
assert_ne!(
result.threat_level,
ThreatLevel::Malicious,
"IMAGE region should not be malicious"
);
// PRIVATE region with RWX is highly suspicious
let private_regions = vec![MemoryRegion {
@@ -218,8 +223,15 @@ mod tests {
}];
let result2 = engine.analyze_process(&process, &private_regions, None);
assert_ne!(result2.threat_level, ThreatLevel::Clean, "RWX private region should be suspicious");
assert!(result2.confidence > 0.3, "RWX private region should have high confidence");
assert_ne!(
result2.threat_level,
ThreatLevel::Clean,
"RWX private region should be suspicious"
);
assert!(
result2.confidence > 0.3,
"RWX private region should have high confidence"
);
}
}

View File

@@ -5,13 +5,10 @@ use crossterm::{
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use ratatui::{
backend::{Backend, CrosstermBackend}, Terminal,
};
use std::{
io,
sync::Arc,
time::Duration,
backend::{Backend, CrosstermBackend},
Terminal,
};
use std::{io, sync::Arc, time::Duration};
use tokio::{sync::Mutex, time};
mod app;