Skip to content

Commit

Permalink
Add: rust: osp-crate
Browse files Browse the repository at this point in the history
Adds a crate that allows communicating with ospd through open scanner
protocol.

It implements the commands:

- Start: to initiate a scan
- Delete: to delete a specific scan
- Stop: to terminate a running scan
- Get: to retrieve scan results
- GetDelete: to fetch and delete scan results simultaneously

For example, here is how you can use OSP:

```rust,ignore
let json_str = r#"{
  "target": {
    "hosts": [
      "127.0.0.1"
    ]
  },
  "vts": [
    {
      "oid": "1.3.6.1.4.1.25623.1.0.10330"
    }
  ]
}"#;

// Deserialize json into a `Scan` struct
let scan: osp::Scan = serde_json::from_str(json_str).unwrap();

// Create a `Start` command using the `Scan`
let cmd = osp::ScanCommand::Start(scan);

// Send the command to the OSPD socket
println!("{:?}", osp::send_command("/run/ospd/ospd-openvas.sock", cmd))
```
  • Loading branch information
nichtsfrei committed May 31, 2023
1 parent 9e50b96 commit 56d28d5
Show file tree
Hide file tree
Showing 21 changed files with 5,548 additions and 13 deletions.
28 changes: 28 additions & 0 deletions rust/Cargo.lock

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

3 changes: 2 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ members = [
"feed",
"feed-verifier",
"scanner-api",
"models"
"models",
"osp",
]
4 changes: 4 additions & 0 deletions rust/doc/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ components:
- error
- host_start
- host_stop
- host_detail
ip_address:
description: "The IPv4 or IPv6 of the target the result was found."
type: "string"
Expand All @@ -566,6 +567,9 @@ components:
message:
description: "Additional information about the result."
type: "string"
details:
description: "An object with key and value pairs. Only set on `host_detail` and should be treated as a `HashMap<String, String>` as there is not formalization possible."
type: "object"
required:
- type

Expand Down
Loading

0 comments on commit 56d28d5

Please sign in to comment.