135 lines
3.6 KiB
Rust
135 lines
3.6 KiB
Rust
use clap::{Parser, Subcommand};
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Parser)]
|
|
#[command(
|
|
name = "xexeu",
|
|
about = "Xexéu — continuous attack-surface and vulnerability auditing",
|
|
version
|
|
)]
|
|
struct Cli {
|
|
#[command(subcommand)]
|
|
command: Command,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
enum Command {
|
|
/// Run the API server, batch ingestion, diffs and the embedded dashboard.
|
|
Serve {
|
|
#[arg(long, default_value = "0.0.0.0:8788")]
|
|
bind: String,
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
#[arg(long, default_value = "data/sweeps")]
|
|
sweeps: PathBuf,
|
|
#[arg(long, default_value = "data/xexeu")]
|
|
data_dir: PathBuf,
|
|
},
|
|
/// Run the continuous scheduler and scan engine, writing sweep batches.
|
|
Scanner {
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
#[arg(long, default_value = "data/sweeps")]
|
|
out: PathBuf,
|
|
},
|
|
/// Run a single sweep for diagnostics.
|
|
Scan {
|
|
#[arg(long)]
|
|
group: Option<String>,
|
|
#[arg(long)]
|
|
once: bool,
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
#[arg(long, default_value = "data/sweeps")]
|
|
out: PathBuf,
|
|
},
|
|
/// Inspect the configuration.
|
|
Config {
|
|
#[command(subcommand)]
|
|
action: ConfigAction,
|
|
},
|
|
/// Synchronize or import vulnerability feeds.
|
|
Feeds {
|
|
#[command(subcommand)]
|
|
action: FeedsAction,
|
|
},
|
|
/// Query change events.
|
|
Changes {
|
|
#[arg(long, default_value = "24h")]
|
|
since: String,
|
|
#[arg(long, default_value = "data/xexeu")]
|
|
data_dir: PathBuf,
|
|
},
|
|
/// Export the current state.
|
|
Export {
|
|
#[arg(long, default_value = "json")]
|
|
format: String,
|
|
#[arg(long, default_value = "data/xexeu")]
|
|
data_dir: PathBuf,
|
|
},
|
|
/// Check the runtime environment.
|
|
Doctor {
|
|
#[arg(long)]
|
|
json: bool,
|
|
},
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
enum ConfigAction {
|
|
/// Validate the configuration and print the effective cadence per group.
|
|
Check {
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
},
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
enum FeedsAction {
|
|
/// Download NVD and CISA KEV feeds incrementally.
|
|
Sync {
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
},
|
|
/// Import feed files copied manually for isolated networks.
|
|
Import {
|
|
directory: PathBuf,
|
|
#[arg(long, default_value = "config/xexeu.toml")]
|
|
config: PathBuf,
|
|
},
|
|
}
|
|
|
|
fn main() {
|
|
let cli = Cli::parse();
|
|
match cli.command {
|
|
Command::Serve {
|
|
bind: _,
|
|
config: _,
|
|
sweeps: _,
|
|
data_dir: _,
|
|
} => not_implemented("serve"),
|
|
Command::Scanner { config: _, out: _ } => not_implemented("scanner"),
|
|
Command::Scan {
|
|
group: _,
|
|
once: _,
|
|
config: _,
|
|
out: _,
|
|
} => not_implemented("scan"),
|
|
Command::Config { action: _ } => not_implemented("config"),
|
|
Command::Feeds { action: _ } => not_implemented("feeds"),
|
|
Command::Changes {
|
|
since: _,
|
|
data_dir: _,
|
|
} => not_implemented("changes"),
|
|
Command::Export {
|
|
format: _,
|
|
data_dir: _,
|
|
} => not_implemented("export"),
|
|
Command::Doctor { json: _ } => not_implemented("doctor"),
|
|
}
|
|
}
|
|
|
|
fn not_implemented(command: &str) -> ! {
|
|
eprintln!("{command}: não implementado ainda");
|
|
std::process::exit(1);
|
|
}
|