Skip to content

Commit a8da7ac

Browse files
committed
Add notus config to scanerctl execute scan
1 parent 95c7078 commit a8da7ac

File tree

1 file changed

+15
-3
lines changed
  • rust/src/scannerctl/execute

1 file changed

+15
-3
lines changed

rust/src/scannerctl/execute/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ struct ScriptArgs {
5959
#[clap(long = "vendor")]
6060
vendor_version: Option<String>,
6161
/// Notus configuration. Use "<IP:PORT>" to connect to a running Notus
62-
/// instance or "<PATH>" to use the internal implementation. If not
63-
/// given Notus will be disabled.
62+
/// instance or "<PATH>" to product files to use the internal
63+
/// implementation. If not given Notus will be disabled.
6464
#[clap(short, long = "notus")]
6565
notus: Option<NotusArgs>,
6666
}
@@ -77,6 +77,11 @@ struct ScanArgs {
7777
/// Target to scan.
7878
#[clap(short, long)]
7979
target: Option<String>,
80+
/// Notus configuration. Use "<IP:PORT>" to connect to a running Notus
81+
/// instance or "<PATH>" to product files to use the internal
82+
/// implementation. If not given Notus will be disabled.
83+
#[clap(short, long = "notus")]
84+
notus: Option<NotusArgs>,
8085
}
8186

8287
pub async fn run(args: ExecuteArgs) -> Result<(), CliError> {
@@ -123,8 +128,15 @@ async fn scan(args: ScanArgs) -> Result<(), CliError> {
123128
} else {
124129
let executor = nasl_std_functions();
125130
let scan = Scan::default_to_localhost(scan);
131+
let notus = args.notus.map(|x| match x {
132+
NotusArgs::Address(addr) => NotusCtx::Address(addr),
133+
NotusArgs::Internal(path) => NotusCtx::Direct(Arc::new(Mutex::new(Notus::new(
134+
HashsumProductLoader::new(Loader::from_feed_path(path)),
135+
false,
136+
)))),
137+
});
126138
let runner: ScanRunner<Arc<InMemoryStorage>> =
127-
ScanRunner::new(&storage, &loader, &executor, schedule, &scan, &None).unwrap();
139+
ScanRunner::new(&storage, &loader, &executor, schedule, &scan, &notus).unwrap();
128140
let mut results = Box::pin(runner.stream());
129141
while let Some(x) = results.next().await {
130142
match x {

0 commit comments

Comments
 (0)