Skip to content

Commit

Permalink
Fix links (#1729)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoStiefvater authored and puethenn committed Oct 29, 2024
1 parent f01f1c4 commit 7f34d3b
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 60 deletions.
4 changes: 1 addition & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ This is the rust scanner implementation with the goal to replace the current sca
(openvas-scanner, ospd-openvas, notus-scanner), including the Open Scanner Protocol (OSP). The rust implementation of the new [HTTP scanner API](https://greenbone.github.io/scanner-api/) is called
**openvasd**. It provides an interface to manage scans for vulnerability testing. It currently utilizes the **openvas-scanner** to perform tasks.

This project also consist of a collection of tools called [**scannerctl**](scannerctl/README.md). It contains variety of utilities for different tasks. For more information look into [**scannerctl**](scannerctl/README.md).

This project also consist of a collection of tools called [**scannerctl**](./src/scannerctl/README.md). It contains variety of utilities for different tasks. For more information look into [**scannerctl**](./src/scannerctl/README.md).

# Implementation of the NASL Attack Scripting Language

Expand All @@ -17,7 +16,6 @@ The decision to rewrite certain parts in rust was mainly to have an easier way t

The implementation is split into multiple parts that are reflected in the directory layout.


# Requirements

- rust toolchain
Expand Down
6 changes: 3 additions & 3 deletions rust/crates/smoketest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ To build and run the tests a Makefile is provided:
- make run - runs a scan against an scanner API listening on http://127.0.0.1:3000.

## Configuration
Usage of api-key is optional. For details on how to configure it, see the [openvasd documentation](../openvasd/README.md).
Usage of api-key is optional. For details on how to configure it, see the [openvasd documentation](../../src/openvasd/README.md).

In case of running the test against a mTLS enabled `openvasd`, you need to configure the client key and cert as well in the smoke test environment. For details on how to configure it, see the [openvasd documentation](../openvasd/README.md).
In case of running the test against a mTLS enabled `openvasd`, you need to configure the client key and cert as well in the smoke test environment. For details on how to configure it, see the [openvasd documentation](../../src/openvasd/README.md).

For creation of the key/cert pair for mTLS authentication, see the tls section in the [openvasd documentation](../openvasd/README.md). Also, you find certificate generators in the [examples](../examples/tls)
For creation of the key/cert pair for mTLS authentication, see the tls section in the [openvasd documentation](../../src/openvasd/README.md). Also, you find certificate generators in the [examples](../../examples/tls/)

For authenticated scans, you can set a custom target (default is 127.0.0.1), username and password.

Expand Down
3 changes: 1 addition & 2 deletions rust/doc/misc/progress-calculation-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ scan_progress = (12 + 75 + 100 * 1) / (12 - 2) = 18.7 %

## Special case for resume task

When a resume task, the finished hosts should not be scanned again. Therefore they are sent in the list of excluded hosts. Please read the documentation for [resume scan](resume-scan.md).
When a resume task, the finished hosts should not be scanned again. Therefore they are sent in the list of excluded hosts. Please read the documentation for [resume scan](../faq/resume-scan.md).
In this case, a resume scan with some finished hosts, should not start with a progress with 0%, but a progress according with the already finished hosts.

Then, imagine that the scan of example above, with an initial target of 15 hosts, was stopped/interrupted and you want to resume it. It has an already finished hosts. This hosts is added to the list of `excluded hosts`.
Expand Down Expand Up @@ -111,4 +111,3 @@ Then, the scan progress for a resume task will start from:
```
scan_progress = (0 + 100 * (0 + 1) / (11 + 1 - 2) = 10 %
```

54 changes: 26 additions & 28 deletions rust/doc/openvasd-osp-cmd-equivalence.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

This document shows the migration of OSP commands (implemented by ospd-openvas) to the new scanner API (implemented by openvasd). It only provides the XML for the command and its corresponding JSON counterpart, as well as the endpoint of the HTTP API. For further information of the commands either see [OSP](https://docs.greenbone.net/API/OSP/osp-22.4.html) or [Scanner API](https://greenbone.github.io/scanner-api/).

# Table of contents
1. [Help command](#Help-command)
2. [Get memory usage command](#Get-memory-usage-command)
3. [Start a scan](#Start-a-scan)
4. [Stop a scan](#Stop-a-scan)
5. [Delete a scan](#Delete-a-scan)
6. [Fetching results](#Fetching-results)
7. [Scan status and progress](#Scan-status-and-progress)
8. [Feed check](#Feed-check)
9. [Get VTs](#Get-VTs)
10. [Get Version](#Get-Version)
11. [Get scanner details](#Get-scanner-details)
12. [Get sensor performance](#Get-sensor-performance)

### Help command
- [Migration Guide for API usage of previous OSP commands](#migration-guide-for-api-usage-of-previous-osp-commands)
- [Help command](#help-command)
- [Get memory usage command](#get-memory-usage-command)
- [Start a scan](#start-a-scan)
- [Stop a scan](#stop-a-scan)
- [Delete a scan](#delete-a-scan)
- [Fetching results](#fetching-results)
- [Scan status and progress](#scan-status-and-progress)
- [Feed check](#feed-check)
- [Get VTs](#get-vts)
- [Get Version](#get-version)
- [Get scanner details](#get-scanner-details)
- [Get sensor performance](#get-sensor-performance)

## Help command

there is a help command which includes all supported OSP commands and details. There is no equivalent command for Scanner API. Just refer to the Scanner API
``` xml
<help/>
```
### Get memory usage command
## Get memory usage command

This command shows RSS, VMS and shared current memory usage. It is a debugging purpose command. There is no equivalent command for Scanner API.
``` xml
<get_memory_usage unit='mb'/>
```
### Start a scan
## Start a scan

***With OSP***

Expand Down Expand Up @@ -123,7 +123,7 @@ Json body:
{"action": "start"}
```

### Stop a scan
## Stop a scan

As explained in the subsection above, you know the scan ID for OSP, because it is necessary for starting a new scan, while the scan ID is created by Openvasd when using Scanner API. Then the scan_id is necessary for both protocols.

Expand All @@ -143,7 +143,7 @@ Json body:
{"action": "stop"}
```

### Delete a scan
## Delete a scan

With the known scan_id, a scan can be deleted. The scan must not be running. So it must be either stopped before or finished. In case of the new scanner API it could also be in the stored status.

Expand All @@ -162,7 +162,7 @@ Endpoint: /scans/{scan_id}
Parameter scan_id: is de Scan ID
```

### Fetching results
## Fetching results

Knowing the scan id, it is possible to fetch results. This command allows some options, like fetching just an amount of results.

Expand All @@ -186,7 +186,7 @@ Parameter scan_id: is de Scan ID.
Optional Query: ?range=start-end, where end is optional as well.
```

### Scan status and progress
## Scan status and progress

***With OSP***

Expand All @@ -205,7 +205,7 @@ Endpoint: /scans/{scan_id}/status
Parameter scan_id: is de Scan ID
```

### Feed check
## Feed check

***With OSP***

Expand All @@ -223,7 +223,7 @@ Endpoint: /health/ready
or /health/alive
or /health/started
```
### Get VTs
## Get VTs

Get a list of Vulnerability test present in the current feed. This includes Notus and NASL tests.

Expand All @@ -249,7 +249,7 @@ Optional Query: ?information=bool shows the whole feed metadata.
```

### Get Version
## Get Version

***With Osp***

Expand All @@ -266,7 +266,7 @@ Only the feed version and the HTTP version are available.
Method: HEAD
```

### Get scanner details
## Get scanner details

Return details about the scanner

Expand All @@ -285,7 +285,7 @@ Method: GET
Entrypoint: scans/preferences
```

### Get sensor performance
## Get sensor performance

Return system report. There is currently no equivalent command for Scanner API

Expand All @@ -295,5 +295,3 @@ More information about this command GOS GVMCG
``` xml
<get_performance start='1706848198' end='1706848198' title='CPU'/>
```


6 changes: 3 additions & 3 deletions rust/src/feed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ FEED_NAME = "short name of the feed";
```
## Verify

[Implements](./src/verify/mod.rs) a [HashSumNameLoader](./src/verify/mod.rs#L93) that loads the filenames defined in the sha256sums and verifies the corresponding hashsum.
Also, implements a [signature verifier](./src/verify/mod.rs#L163) for checking the signature of the sha256sums file.
[Implements](./verify/mod.rs) a `HashSumNameLoader` that loads the filenames defined in the sha256sums and verifies the corresponding hashsum.
Also, implements a `signature verifier` for checking the signature of the sha256sums file.

### Example

```no_run
```rs,no_run
use scannerlib::nasl::FSPluginLoader;
// needs to be path that contains a sha256sums file otherwise
// it will throw an exception.
Expand Down
4 changes: 2 additions & 2 deletions rust/src/nasl/builtin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contains functions that are within the std library of nasl.

To use the std functions it is recommended to use the defined [ContextFactory] as it sets the function register to the one created in [nasl_std_functions] automatically.
To use the std functions it is recommended to use the defined `ContextFactory` as it sets the function register to the one created in `nasl_std_functions` automatically.

All you have to do as a user is to create the builder

Expand All @@ -29,7 +29,7 @@ To add a function to std you have to add function crate to the Cargo.toml
nasl-builtin-string = {path = "../nasl-builtin-string"}
```

and then extend the builder within [nasl_std_functions] with the implementation of [nasl_builtin_utils::NaslFunctionExecuter] of those functions:
and then extend the builder within `nasl_std_functions` with the implementation of `nasl_builtin_utils::NaslFunctionExecuter` of those functions:

```text
builder = builder.push_register(nasl_builtin_string::NaslString)
Expand Down
13 changes: 5 additions & 8 deletions rust/src/nasl/interpreter/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# nasl-interpreter

Is a library that is utilizing [nasl-syntax](../syntax/) and [storage](../../openvasd/storage/) to execute statements.

Is a library that is utilizing [nasl-syntax](../nasl-syntax/) and [storage](../storage/) to execute statements.
The core part is written in [interpreter.rs](./interpreter.rs) and is separated into various extensions to execute a given `Statement` when `resolve` is called.

The core part is written in [interpreter.rs](./src/interpreter.rs) and is separated into various extensions to execute a given `Statement` when `resolve` is called.

Each resolve call will result in a [NaslValue](./src/naslvalue.rs) or an [InterpretError](./src/error.rs) return value.
Each resolve call will result in a [NaslValue](../syntax/naslvalue.rs) or an [InterpretError](../syntax/error.rs) return value.

An interpreter requires:

Expand All @@ -16,7 +15,6 @@ An interpreter requires:
- `loader: &'a dyn Loader` - is used to load script dependencies on `include`,
- `logger: Box<dyn NaslLogger>` - the default logger


## Example

```
Expand All @@ -30,18 +28,17 @@ let code = "display('hi');";
let mut parser = CodeInterpreter::new(code, register, &context);
```


## Built in functions

It provides a set of builtin functionality within [built_in_functions](./src/built_in_functions/) to add a new functionality you have to enhance the lookup function within [lib.rs](./src/lib.rs).
It provides a set of builtin functionality within [built_in_functions](../builtin/) to add a new functionality you have to enhance the lookup function within [lib.rs](../../lib.rs).

Each builtin function follow the syntax of:

```text
fn(&str, &dyn storage, &Register) -> Result<NaslValue, FunctionError>
```

An example of how to write a new builtin function can be found in [misc](./src/built_in_functions/misc.rs).
An example of how to write a new builtin function can be found in [misc](../builtin/misc/).

## Build

Expand Down
2 changes: 1 addition & 1 deletion rust/src/nasl/syntax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`nasl-syntax` is a library to provide structured representation of NASL code.

It will return an Iterator with either a [statement](./src/statement.rs) for further execution or an [error](./src/error.rs) if the given code was incorrect.
It will return an Iterator with either a [statement](./statement.rs) for further execution or an [error](./error.rs) if the given code was incorrect.

Each statement is self contained and it is expected to be executed iteratively and therefore there is no visitor implementation.

Expand Down
20 changes: 17 additions & 3 deletions rust/src/openvasd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ Is the implementation for [scanner-api](https://greenbone.github.io/scanner-api/

Currently it is utilizing ospd-openvas.

- [OpenVAS Daemon](#openvas-daemon)
- [Requirements](#requirements)
- [Configuration](#configuration)
- [Authentication](#authentication)
- [API Key](#api-key)
- [Certificates](#certificates)
- [How does mTLS works?](#how-does-mtls-works)
- [Certificate Authority for PKI mTLS Method](#certificate-authority-for-pki-mtls-method)
- [mTLS with self-signed client certificates.](#mtls-with-self-signed-client-certificates)
- [Mode](#mode)
- [Usage](#usage)
- [Feed signature check.](#feed-signature-check)
- [Options](#options)
- [Migration from previous OSP commands](#migration-from-previous-osp-commands)

# Requirements

It requires a running ospd-openvas instance.
Expand All @@ -17,7 +32,7 @@ Create a configuration file under either:

or provide the `-c` flag when starting openvasd.

An example can be found [here](../examples/openvasd/config.example.toml)
An example can be found [here](../../examples/openvasd/config.example.toml)

## Authentication

Expand Down Expand Up @@ -118,7 +133,6 @@ As can be seen, no CA certificate is used, since instead the client certificate

Openvasd currently supports two operation modes. The `service` mode supports all available endpoints, where the `service_notus` mode only supports the notus related endpoints.


# Usage

```
Expand Down Expand Up @@ -218,4 +232,4 @@ If the signature check is enabled, it is also required to set the the `GNUPGHOME

# Migration from previous OSP commands

In this [page](doc/osp-cmd-equivalence.md) you can find a guide for API usage of previous OSP commands
In this [page](../../doc/openvasd-osp-cmd-equivalence.md) you can find a guide for API usage of previous OSP commands
4 changes: 2 additions & 2 deletions rust/src/scannerctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Options:
On `feed transform` it will first read the `sha256sums` file within the feed directory and verify each file with the corresponding sha256sums. When the hash is correct it will execute each mentioned `*.nasl` script within that dir with `description = 1`.
Optionally, it is possible to perform a signature verification of the sha256sums file before the transformation. To enable the signature check, the environment variable `GNUPGHOME` must be set with the gnupg home directory, where the `pubring.kbx` file is stored.

It will produce a json array in stdout in the format described within [json-storage](../json-storage/README.md).
It will produce a json array in stdout in the format described within [json-storage](../storage/json/README.md)

#### transpile

Expand All @@ -238,7 +238,7 @@ Options:
- `-r`, `--rules <FILE>`: Path to transpiler rules.
- `-h`, `--help`: Print help

An example can be found in [examples](../examples/scannerctl/transpile.toml) folder. This example demonstrates how to
An example can be found in [examples](../../examples/scannerctl/transpile.toml) folder. This example demonstrates how to
- rename service `www` to `word-wide-web` in register_product
- `register_host_detail` to `add_host_detail`

Expand Down
13 changes: 9 additions & 4 deletions rust/src/storage/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# storage

```
```


Is a specialized library to handle data from the nasl-interpreter to the storage / distribution implementation.

To be able to introduce new distribution implementations the [Dispatcher](src/lib.rs#L80) must be implement.
To be able to introduce new distribution implementations the `Dispatcher` must be implement.

The [Field](src/lib.rs#L21) enum required by `dispatch` method describes fields to be distributed.
The `Field` enum required by `dispatch` method describes fields to be distributed.

The reason that it uses field descriptions rather than structs are two fold:
1. it allows the usage of streaming distribution
2. it makes it easier to store information immediately on execution

Since we sometimes have the requirement to just store when all information is available the [on_exit](src/lib.rs#L93) must be called when the interpreter finishes.
Since we sometimes have the requirement to just store when all information is available the `on_exit` must be called when the interpreter finishes.

A simplified example on how to write a storage implementation can be found in [DefaultDispatcher](src/lib.rs#L116)
A simplified example on how to write a storage implementation can be found in `DefaultDispatcher`

## Build

Expand Down
2 changes: 1 addition & 1 deletion rust/src/storage/redis/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# redis-storage

Is the redis implementation for [storage](../storage/).
Is the redis implementation for [storage](../../storage/).

It is written in a downwards compatible way so that `ospd-openvas` is capable of reading and writing the data.

0 comments on commit 7f34d3b

Please sign in to comment.