| 1 |
General Usage Instructions for ospd-based Scanners |
| 2 |
-------------------------------------------------- |
| 3 |
|
| 4 |
This is a general description about using an ospd-based scanner wrapper |
| 5 |
implementation. |
| 6 |
|
| 7 |
The actual scanner implementation has individual usage instructions for anything |
| 8 |
that goes beyond this general guide. |
| 9 |
|
| 10 |
In the following description replace `ospd-scanner` with the name of the actual |
| 11 |
OSPD scanner. |
| 12 |
|
| 13 |
See the documentation of your ospd-based scanner and the general instructions in |
| 14 |
the [INSTALL-ospd-scanner.md](INSTALL-ospd-scanner.md) file on how to hand over |
| 15 |
full control to the Greenbone Vulnerability Manager. |
| 16 |
|
| 17 |
This usage guide explains how to use an OSP scanner independently of Greenbone |
| 18 |
Vulnerability Manager, for example when developing a new ospd-based scanner or |
| 19 |
for testing purposes. |
| 20 |
|
| 21 |
|
| 22 |
Open Scanner Protocol |
| 23 |
--------------------- |
| 24 |
|
| 25 |
Using an ospd-based scanner means using the Open Scanner Protocol (OSP). This is |
| 26 |
what Greenbone Vulnerability Manager does. See the ospd module for the original |
| 27 |
specification available in [ospd/doc/OSP.xml](OSP.xml). |
| 28 |
|
| 29 |
There is also an online version available at |
| 30 |
<https://docs.greenbone.net/API/OSP/osp-21.04.html>. |
| 31 |
|
| 32 |
|
| 33 |
gvm-tools |
| 34 |
--------- |
| 35 |
|
| 36 |
The `gvm-tools` help to make accessing the OSP interface easier. |
| 37 |
They can be obtained from <https://github.com/greenbone/gvm-tools>. |
| 38 |
|
| 39 |
This module provides the commands `gvm-cli` and `gvm-pyshell`. |
| 40 |
|
| 41 |
|
| 42 |
Starting an ospd-based scanner |
| 43 |
------------------------------ |
| 44 |
|
| 45 |
All ospd-based scanners share a set of command-line options such as |
| 46 |
`--help`, `--bind-address`, `--port`, `--key-file`, `--timeout`, etc. |
| 47 |
|
| 48 |
For example, to see the command line options you can run: |
| 49 |
|
| 50 |
ospd-scanner --help |
| 51 |
|
| 52 |
To run an instance of `ospd-scanner` listening on Unix domain socket: |
| 53 |
|
| 54 |
ospd-scanner -u <prefix>/var/run/ospd-scanner.sock & |
| 55 |
|
| 56 |
To run a test instance of `ospd-scanner` on local TCP port 1234: |
| 57 |
|
| 58 |
ospd-scanner -b 127.0.0.1 -p 1234 & |
| 59 |
|
| 60 |
Add `--log-level=DEBUG` to enable maximum debugging output. |
| 61 |
|
| 62 |
Parameter for `--log-level` can be one of `DEBUG`, `INFO`, `WARNING`, `ERROR` or |
| 63 |
`CRITICAL` (in order of priority). |
| 64 |
|
| 65 |
|
| 66 |
Controlling an OSP scanner |
| 67 |
-------------------------- |
| 68 |
|
| 69 |
You can use command line tools provided by the `gvm-tools` module to interact |
| 70 |
with an OSP scanner. |
| 71 |
|
| 72 |
To get a description of the interface: |
| 73 |
|
| 74 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml "<help/>" |
| 75 |
|
| 76 |
|
| 77 |
Starting a scan (scanner parameters can be added according to the description |
| 78 |
printed as response to the `<help/>` command): |
| 79 |
|
| 80 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml="<start_scan target='www.example.com'></start_scan>" |
| 81 |
|
| 82 |
|
| 83 |
Start a scan for ospd-based scanners that use the builtin-support for SSH |
| 84 |
authentication: |
| 85 |
|
| 86 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml="<start_scan target='www.example.com' ports=''><scanner_params><username_password>myuser:mypassword</username_password></scanner_params></start_scan>" |
| 87 |
|
| 88 |
|
| 89 |
Start a scan for two vulnerability tests `vt_id_1` and `vt_id_2` of an ospd-based |
| 90 |
scanner: |
| 91 |
|
| 92 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml="<start_scan target='www.example.com'><scanner_params></scanner_params><vts>vt_id_1, vt_id_2</vts></start_scan>" |
| 93 |
|
| 94 |
|
| 95 |
Show the list of scans with status and results: |
| 96 |
|
| 97 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml="<get_scans/>" |
| 98 |
|
| 99 |
|
| 100 |
Delete a scan from this list (only finished scans can be deleted): |
| 101 |
|
| 102 |
gvm-cli socket --sockpath <prefix>/var/run/ospd-scanner.sock --xml="<delete_scan scan_id='013587e3-b4d7-8e79-9ebb-90a2133c338c'/>" |