mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-27 20:29:39 +02:00
Add max_file_size_mb and high_only logic to scanning process:
- Implement `max_file_size_mb` to restrict files for scanning based on size. - Refactor `high_only` handling to modify `min_severity` in `Config`. - Update `ScannerConfig` to use `Option<u64>` for optional size limits. - Remove redundant `high_only` parameter from `scan::handle` function. - Improve batch processing in `walk` for efficient file scanning.
This commit is contained in:
parent
b3e0db449d
commit
80c0bc9845
6 changed files with 47 additions and 15 deletions
|
|
@ -5,16 +5,19 @@ pub mod clean;
|
|||
|
||||
use crate::cli::Commands;
|
||||
use std::path::Path;
|
||||
use crate::patterns::Severity;
|
||||
use crate::utils::config::Config;
|
||||
|
||||
pub fn handle_command(
|
||||
command: Commands,
|
||||
database_dir: &Path,
|
||||
config: &Config
|
||||
config: &mut Config
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
match command {
|
||||
Commands::Scan { path, no_index, rebuild_index, format, high_only } => {
|
||||
scan::handle(&path, no_index, rebuild_index, format, high_only, database_dir, config)
|
||||
if high_only { config.scanner.min_severity = Severity::High };
|
||||
|
||||
scan::handle(&path, no_index, rebuild_index, format, database_dir, config)
|
||||
}
|
||||
Commands::Index { action } => {
|
||||
index::handle(action, database_dir, config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue