Skip to content

Commit

Permalink
Add: possibility to use nasl-interpreter#Scanner
Browse files Browse the repository at this point in the history
To have the possibility to very nasl-interpreter implementation not just
from scannerctl but also openvasd it is integrated into openvasd.

To enable nasl-interpreter configure openvasd to use the scanner type
`openvasd`.
  • Loading branch information
Tehforsch authored and nichtsfrei committed Jul 26, 2024
1 parent 71aafc7 commit 38b4297
Show file tree
Hide file tree
Showing 17 changed files with 604 additions and 756 deletions.
2 changes: 2 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions rust/nasl-builtin-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ pub fn get_named_parameter<'a>(
/// Holds registered NaslFunctionExecuter and executes them in order of registration.
#[derive(Default)]
pub struct NaslFunctionRegister {
executor: Vec<Box<dyn NaslFunctionExecuter>>,
executor: Vec<Box<dyn NaslFunctionExecuter + Send>>,
}

impl NaslFunctionRegister {
/// Creates a new NaslFunctionRegister
pub fn new(executor: Vec<Box<dyn NaslFunctionExecuter>>) -> Self {
pub fn new(executor: Vec<Box<dyn NaslFunctionExecuter + Send>>) -> Self {
Self { executor }
}

/// Pushes a NaslFunctionExecuter to the register
pub fn push_executer<T>(&mut self, executor: T)
where
T: NaslFunctionExecuter + 'static,
T: NaslFunctionExecuter + Send + 'static,
{
self.executor.push(Box::new(executor));
}
Expand Down Expand Up @@ -145,7 +145,7 @@ impl NaslFunctionExecuter for NaslFunctionRegister {
#[derive(Default)]
/// A builder for NaslFunctionRegister
pub struct NaslfunctionRegisterBuilder {
executor: Vec<Box<dyn NaslFunctionExecuter>>,
executor: Vec<Box<dyn NaslFunctionExecuter + Send>>,
}

impl NaslfunctionRegisterBuilder {
Expand All @@ -159,7 +159,7 @@ impl NaslfunctionRegisterBuilder {
/// Pushes a NaslFunctionExecuter to the register
pub fn push_register<T>(mut self, executor: T) -> Self
where
T: NaslFunctionExecuter + 'static,
T: NaslFunctionExecuter + Send + 'static,
{
self.executor.push(Box::new(executor));
self
Expand Down
2 changes: 2 additions & 0 deletions rust/nasl-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ nasl-builtin-std = {path = "../nasl-builtin-std", default-features = false}
regex = "1"
tracing = "0.1.40"
thiserror = "1.0.60"
async-trait = "0.1.77"
tokio = "1.38.0"

[features]
nasl-builtin-raw-ip = ["nasl-builtin-std/nasl-builtin-raw-ip"]
Expand Down
4 changes: 4 additions & 0 deletions rust/nasl-interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod interpreter;
mod loop_extension;
mod operator;
mod scan_interpreter;
mod scanner;
pub mod scheduling;

pub use error::FunctionError;
Expand All @@ -26,6 +27,9 @@ pub use interpreter::ContextLifeTimeCapture;
pub use interpreter::Interpreter;
pub use scan_interpreter::*;

pub use scanner::DefaultScannerStack;
pub use scanner::Scanner;

// we expose the other libraries to allow users to use them without having to import them
pub use nasl_builtin_std::{nasl_std_functions, ContextFactory, RegisterBuilder};
pub use nasl_builtin_utils::{
Expand Down
Loading

0 comments on commit 38b4297

Please sign in to comment.