pub mod discover;
pub mod info;
pub mod listen;
pub mod scan;
use clap::{ArgAction, Parser, Subcommand};
use zond_engine::core::config::ZondConfig;
use zond_engine::core::models::port::PortSet;
#[derive(Parser)]
#[command(name = "zond")]
#[command(version = env!("CARGO_PKG_VERSION"))]
#[command(about = "Deep network reconnaissance and probing tool.", long_about = None)]
#[command(propagate_version = true)]
pub struct CommandLine {
#[command(subcommand)]
pub command: Commands,
#[arg(long = "no-banner", global = true)]
pub no_banner: bool,
#[arg(short = 'n', long = "no-dns", global = true)]
pub no_dns: bool,
#[arg(
short = 'p',
long = "ports",
global = true,
default_value = "22, 80, 443, 445, 3389"
)]
pub ports: PortSet,
#[arg(short = 'q', long = "quiet", action = ArgAction::Count, global = true)]
pub quiet: u8,
#[arg(long = "redact", global = true)]
pub redact: bool,
#[arg(short = 'v', long = "verbose", action = ArgAction::Count, global = true)]
pub verbosity: u8,
}
#[derive(Subcommand)]
pub enum Commands {
#[command(alias = "i")]
Info,
#[command(alias = "l")]
Listen,
#[command(alias = "d")]
Discover {
#[arg(value_name = "TARGETS", num_args(1..))]
targets: Vec<String>,
},
#[command(alias = "s")]
Scan {
#[arg(value_name = "TARGETS", num_args(1..))]
targets: Vec<String>,
},
}
impl CommandLine {
pub fn parse_args() -> Self {
Self::parse()
}
}
impl From<&CommandLine> for ZondConfig {
fn from(cmd: &CommandLine) -> Self {
Self {
no_banner: cmd.no_banner,
no_dns: cmd.no_dns,
redact: cmd.redact,
quiet: cmd.quiet,
disable_input: false,
}
}
}