From 9a9e94af8dd0103027a9c421d5866aced3a6a4fb Mon Sep 17 00:00:00 2001 From: pandaadir05 Date: Thu, 20 Nov 2025 14:28:03 +0200 Subject: [PATCH] Update detection configuration structure --- ghost-core/src/config.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ghost-core/src/config.rs b/ghost-core/src/config.rs index 996b6b0..aab4d12 100644 --- a/ghost-core/src/config.rs +++ b/ghost-core/src/config.rs @@ -85,7 +85,7 @@ impl DetectionConfig { } /// Validates the configuration values. - fn validate(&self) -> Result<(), GhostError> { + pub fn validate(&self) -> Result<(), GhostError> { if self.confidence_threshold < 0.0 || self.confidence_threshold > 1.0 { return Err(GhostError::Configuration { message: "confidence_threshold must be between 0.0 and 1.0".into(), @@ -163,16 +163,27 @@ impl ProcessFilter { pub fn should_scan(&self, process_name: &str) -> bool { // If whitelist is not empty, only scan whitelisted processes if !self.whitelist.is_empty() { - return self.whitelist.iter().any(|name| process_name.contains(name)); + return self + .whitelist + .iter() + .any(|name| process_name.contains(name)); } // Skip blacklisted processes - if self.blacklist.iter().any(|name| process_name.contains(name)) { + if self + .blacklist + .iter() + .any(|name| process_name.contains(name)) + { return false; } // Skip system processes if configured - if self.system_processes.iter().any(|name| process_name == name) { + if self + .system_processes + .iter() + .any(|name| process_name == name) + { return false; } @@ -188,7 +199,7 @@ mod tests { fn test_default_config() { let config = DetectionConfig::default(); assert!(config.shellcode_detection); - assert_eq!(config.confidence_threshold, 0.7); + assert_eq!(config.confidence_threshold, 0.3); } #[test] @@ -208,4 +219,4 @@ mod tests { assert!(filter.should_scan("notepad.exe")); assert!(!filter.should_scan("malware.exe")); } -} \ No newline at end of file +}