1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(
name = "noctis",
about = "Vulnerability scanner — YAML-driven, Rust-native",
version
)]
pub struct Cli {
/// Log verbosity (-v INFO, -vv DEBUG, -vvv TRACE)
#[arg(short, long, action = clap::ArgAction::Count, global = true)]
pub verbose: u8,
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Start the REST API daemon
Serve(ServeArgs),
/// Install or locate the detection feed set
Feeds(FeedsArgs),
}
#[derive(Parser, Debug)]
pub struct FeedsArgs {
/// Feeds directory [default: $NOCTIS_FEEDS_DIR, $XDG_DATA_HOME/noctis/feeds,
/// ~/.local/share/noctis/feeds, %LOCALAPPDATA%\noctis\feeds on Windows]
#[arg(long, global = true)]
pub feeds_dir: Option<PathBuf>,
#[command(subcommand)]
pub command: FeedsCommand,
}
#[derive(Subcommand, Debug)]
pub enum FeedsCommand {
/// Download the feed set of a GitHub Release and install it into the feeds directory
Update {
/// Release to take the feeds from: vX.Y.Z or "latest" [default: this binary's version]
#[arg(long, conflicts_with = "archive")]
tag: Option<String>,
/// Install a noctis-feeds.tar.gz already on disk instead of downloading it
/// (checked against <ARCHIVE>.sha256 when that file exists)
#[arg(long, value_name = "ARCHIVE")]
archive: Option<PathBuf>,
},
/// Print the feeds directory
Path,
}
#[derive(Parser, Debug)]
pub struct ServeArgs {
/// Address to listen on
#[arg(long, default_value = "0.0.0.0")]
pub host: String,
/// Port to listen on
#[arg(long, default_value_t = 8080)]
pub port: u16,
/// Enable the integrated OOB HTTP callback server
#[arg(long)]
pub oob: bool,
/// OOB server host — must be reachable from scan targets
#[arg(long, default_value = "127.0.0.1")]
pub oob_host: String,
/// OOB server listening port
#[arg(long, default_value_t = 9090)]
pub oob_port: u16,
/// Feeds directory: relative `tests` entries of a scan request that match nothing
/// from the working directory are looked up here (see `noctis feeds update`)
/// [default: $NOCTIS_FEEDS_DIR, then the `noctis feeds path` default]
#[arg(long)]
pub feeds_dir: Option<PathBuf>,
}