Standardize import ordering and code formatting

This commit is contained in:
pandaadir05
2025-11-20 14:25:44 +02:00
parent 34007d11c1
commit e44f58e308
14 changed files with 823 additions and 546 deletions

View File

@@ -1,4 +1,4 @@
use crate::{ProcessInfo, MemoryRegion, GhostError};
use crate::{GhostError, MemoryRegion, ProcessInfo};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::time::SystemTime;
@@ -87,22 +87,20 @@ impl DynamicYaraEngine {
pub async fn update_rules(&mut self) -> Result<usize, GhostError> {
let mut updated_count = 0;
for source in &mut self.sources {
if !source.enabled {
continue;
}
// Simulate rule download
let new_rules = vec![
YaraRule {
name: format!("generic_malware_{}", updated_count + 1),
content: "rule generic_malware { condition: true }".to_string(),
source: source.name.clone(),
threat_level: ThreatLevel::Medium,
last_updated: SystemTime::now(),
},
];
let new_rules = vec![YaraRule {
name: format!("generic_malware_{}", updated_count + 1),
content: "rule generic_malware { condition: true }".to_string(),
source: source.name.clone(),
threat_level: ThreatLevel::Medium,
last_updated: SystemTime::now(),
}];
self.rules.extend(new_rules);
source.rule_count = self.rules.len();
@@ -125,7 +123,7 @@ impl DynamicYaraEngine {
// Simulate YARA scanning
for (i, region) in memory_regions.iter().enumerate() {
bytes_scanned += region.size;
// Simulate finding suspicious patterns
if region.protection.is_executable() && region.protection.is_writable() {
matches.push(RuleMatch {
@@ -138,9 +136,7 @@ impl DynamicYaraEngine {
}
}
let scan_time_ms = start_time.elapsed()
.unwrap_or_default()
.as_millis() as u64;
let scan_time_ms = start_time.elapsed().unwrap_or_default().as_millis() as u64;
Ok(YaraScanResult {
matches,
@@ -156,4 +152,4 @@ impl DynamicYaraEngine {
pub fn get_sources(&self) -> &[YaraRuleSource] {
&self.sources
}
}
}