Skip to content

Commit 093764d

Browse files
committed
Change: rename scanner_preferences -> scan_preferences
For backwards compatability, the alias scanner_preferences can still be used
1 parent fc30c99 commit 093764d

File tree

9 files changed

+47
-49
lines changed

9 files changed

+47
-49
lines changed

rust/doc/openapi.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,11 @@ components:
414414
properties:
415415
target:
416416
$ref: "#/components/schemas/Target"
417-
scanner_preferences:
417+
scan_preferences:
418418
description: "Overwrite the default settings of the Scanner."
419419
type: "array"
420420
items:
421-
$ref: "#/components/schemas/ScannerPreference"
421+
$ref: "#/components/schemas/ScanPreference"
422422
vts:
423423
type: "array"
424424
description: "A collection of VTs, which are run for the given target."
@@ -445,11 +445,11 @@ components:
445445
$ref: "#/components/schemas/ScanID"
446446
target:
447447
$ref: "#/components/schemas/Target"
448-
scanner_preferences:
448+
scan_preferences:
449449
description: "Overwrite the default settings of the Scanner."
450450
type: "array"
451451
items:
452-
$ref: "#/components/schemas/ScannerPreference"
452+
$ref: "#/components/schemas/ScanPreference"
453453
vts:
454454
type: "array"
455455
description: "A collection of VTs, which are run for the given target."
@@ -634,7 +634,7 @@ components:
634634
- aes
635635
- des
636636

637-
ScannerPreference:
637+
ScanPreference:
638638
description: "Consists of a preference ID and its value."
639639
type: "object"
640640
properties:
@@ -897,10 +897,7 @@ components:
897897
"2002::1234:abcd:ffff:c0a8:101/64",
898898
"examplehost",
899899
],
900-
"excluded_hosts":
901-
[
902-
"192.168.0.14"
903-
],
900+
"excluded_hosts": ["192.168.0.14"],
904901
"ports":
905902
[
906903
{
@@ -949,7 +946,7 @@ components:
949946
"reverse_lookup_unify": true,
950947
"reverse_lookup_only": false,
951948
},
952-
"scanner_preferences":
949+
"scan_preferences":
953950
[
954951
{ "id": "target_port", "value": "443" },
955952
{ "id": "use_https", "value": "1" },
@@ -1030,7 +1027,7 @@ components:
10301027
"reverse_lookup_unify": true,
10311028
"reverse_lookup_only": false,
10321029
},
1033-
"scanner_preferences":
1030+
"scan_preferences":
10341031
[
10351032
{ "id": "target_port", "value": "443" },
10361033
{ "id": "use_https", "value": "1" },

rust/doc/reverse-sensor-openapi.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,22 @@ paths:
152152
parameters:
153153
- $ref: "#/components/parameters/ScanID"
154154
requestBody:
155-
description: "The new status"
156-
content:
157-
application/json:
155+
description: "The new status"
156+
content:
157+
application/json:
158+
schema:
159+
$ref: "#/components/schemas/Status"
160+
examples:
158161
schema:
159-
$ref: "#/components/schemas/Status"
160-
examples:
161-
schema:
162-
description: "Schema of a status response."
163-
status of a stored scan:
164-
$ref: "#/components/examples/scan_status_stored"
165-
status of a running scan:
166-
$ref: "#/components/examples/scan_status_running"
167-
status of a succeeded scan:
168-
$ref: "#/components/examples/scan_status_success"
169-
status of a failed scan:
170-
$ref: "#/components/examples/scan_status_fail"
162+
description: "Schema of a status response."
163+
status of a stored scan:
164+
$ref: "#/components/examples/scan_status_stored"
165+
status of a running scan:
166+
$ref: "#/components/examples/scan_status_running"
167+
status of a succeeded scan:
168+
$ref: "#/components/examples/scan_status_success"
169+
status of a failed scan:
170+
$ref: "#/components/examples/scan_status_fail"
171171
responses:
172172
"204":
173173
description: "Status received"
@@ -228,11 +228,11 @@ components:
228228
$ref: "#/components/schemas/ScanID"
229229
target:
230230
$ref: "#/components/schemas/Target"
231-
scanner_preferences:
231+
scan_preferences:
232232
description: "Overwrite the default settings of the Scanner."
233233
type: "array"
234234
items:
235-
$ref: "#/components/schemas/ScannerPreference"
235+
$ref: "#/components/schemas/ScanPreference"
236236
vts:
237237
type: "array"
238238
description: "A collection of VTs, which are run for the given target."
@@ -396,7 +396,7 @@ components:
396396
- aes
397397
- des
398398

399-
ScannerPreference:
399+
ScanPreference:
400400
description: "Consists of a preference ID and its value."
401401
type: "object"
402402
properties:
@@ -573,14 +573,10 @@ components:
573573
items:
574574
$ref: "#/components/schemas/ScanAction"
575575

576-
577576
examples:
578577
sensor_simple:
579578
description: "A simple example for sensor."
580-
value:
581-
{
582-
"sensor_id": "6c591f83-8f7b-452a-8c78-ba35779e682f"
583-
}
579+
value: { "sensor_id": "6c591f83-8f7b-452a-8c78-ba35779e682f" }
584580
scan_simple:
585581
description: "A simple example for creating a scan."
586582
value:
@@ -656,7 +652,7 @@ components:
656652
"reverse_lookup_unify": true,
657653
"reverse_lookup_only": false,
658654
},
659-
"scanner_preferences":
655+
"scan_preferences":
660656
[
661657
{ "id": "target_port", "value": "443" },
662658
{ "id": "use_https", "value": "1" },
@@ -677,19 +673,20 @@ components:
677673
value: "6c591f83-8f7b-452a-8c78-ba35779e682f"
678674
scan_actions:
679675
description: "Actions to perform"
680-
value: [
676+
value:
677+
[
681678
{
682679
"scan_id": "6c591f83-8f7b-452a-8c78-ba35779e682f",
683-
"action": "start"
680+
"action": "start",
684681
},
685682
{
686683
"scan_id": "24591f83-8f7b-452a-8c78-ba35779e6816",
687-
"action": "stop"
684+
"action": "stop",
688685
},
689686
{
690687
"scan_id": "13591f83-8f74-45da-8c7d-ba35779e682a",
691-
"action": "delete"
692-
}
688+
"action": "delete",
689+
},
693690
]
694691

695692
scan_results:

rust/models/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ mod product;
1111
mod result;
1212
mod scan;
1313
mod scan_action;
14+
mod scan_preference;
1415
pub mod scanner;
15-
mod scanner_preference;
1616
mod status;
1717
mod target;
1818
mod vt;
@@ -26,7 +26,7 @@ pub use product::*;
2626
pub use result::*;
2727
pub use scan::*;
2828
pub use scan_action::*;
29-
pub use scanner_preference::*;
29+
pub use scan_preference::*;
3030
pub use status::*;
3131
pub use target::*;
3232
pub use vt::*;
@@ -137,7 +137,7 @@ mod tests {
137137
"reverse_lookup_unify": true,
138138
"reverse_lookup_only": false
139139
},
140-
"scanner_preferences": [
140+
"scan_preferences": [
141141
{
142142
"id": "target_port",
143143
"value": "443"

rust/models/src/scan.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// SPDX-License-Identifier: GPL-2.0-or-later
44

5-
use super::{scanner_preference::ScannerPreference, target::Target, vt::VT};
5+
use super::{scan_preference::ScanPreference, target::Target, vt::VT};
66

77
/// Struct for creating and getting a scan
88
#[derive(Default, Debug, Clone, PartialEq, Eq)]
@@ -17,9 +17,12 @@ pub struct Scan {
1717
pub scan_id: String,
1818
/// Information about the target to scan
1919
pub target: Target,
20-
#[cfg_attr(feature = "serde_support", serde(default))]
20+
#[cfg_attr(
21+
feature = "serde_support",
22+
serde(default, alias = "scanner_preferences")
23+
)]
2124
/// Configuration options for the scanner
22-
pub scanner_preferences: Vec<ScannerPreference>,
25+
pub scan_preferences: Vec<ScanPreference>,
2326
/// List of VTs to execute for the target
2427
pub vts: Vec<VT>,
2528
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
feature = "serde_support",
99
derive(serde::Serialize, serde::Deserialize)
1010
)]
11-
pub struct ScannerPreference {
11+
pub struct ScanPreference {
1212
/// The ID of the scanner preference.
1313
pub id: String,
1414
/// The value of the scanner preference.

rust/openvas/src/pref_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ where
339339
async fn prepare_scan_params_for_openvas(&mut self) -> RedisStorageResult<()> {
340340
let options = self
341341
.scan_config
342-
.scanner_preferences
342+
.scan_preferences
343343
.clone()
344344
.iter()
345345
.map(|x| format!("{}|||{}", x.id, x.value))

rust/openvasd/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod controller;
1313
pub mod crypt;
1414
pub mod feed;
1515
pub mod notus;
16+
pub mod preference;
1617
pub mod request;
1718
pub mod response;
1819
mod scheduling;

rust/openvasd/src/preference.rs

Whitespace-only changes.

rust/osp/src/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn write_vts(scan: &Scan, writer: &mut Writer) -> Result<()> {
185185
// it is called scanner parameters.
186186
fn write_scanner_prefs(scan: &Scan, writer: &mut Writer) -> Result<()> {
187187
writer.write_event(Event::Start(BytesStart::new("scanner_params")))?;
188-
for p in &scan.scanner_preferences {
188+
for p in &scan.scan_preferences {
189189
writer.write_event(Event::Start(BytesStart::new(&p.id)))?;
190190
writer.write_event(Event::Text(BytesText::new(&p.value)))?;
191191
writer.write_event(Event::End(BytesEnd::new(&p.id)))?;

0 commit comments

Comments
 (0)