diff --git a/rust/Cargo.lock b/rust/Cargo.lock index c9d0dd5bb..a7854f5dc 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -287,6 +287,12 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.5.0" @@ -1319,6 +1325,7 @@ dependencies = [ "criterion", "pbkdf2", "rand", + "rmp-serde", "serde", "sha2", "uuid", @@ -2048,6 +2055,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pbkdf2" version = "0.12.2" @@ -2532,6 +2545,28 @@ dependencies = [ "digest", ] +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2948,6 +2983,7 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" name = "storage" version = "0.1.0" dependencies = [ + "bincode 2.0.0-rc.3", "models", "serde", "time", diff --git a/rust/examples/README.md b/rust/examples/README.md new file mode 100644 index 000000000..563142f78 --- /dev/null +++ b/rust/examples/README.md @@ -0,0 +1,3 @@ +This contains a rudimentary feed for testing purposes. + +This is not a real feed. diff --git a/rust/examples/feed/nasl/1.nasl b/rust/examples/feed/nasl/1.nasl new file mode 100644 index 000000000..c11d7fc68 --- /dev/null +++ b/rust/examples/feed/nasl/1.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.1"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/10.nasl b/rust/examples/feed/nasl/10.nasl new file mode 100644 index 000000000..66646db1d --- /dev/null +++ b/rust/examples/feed/nasl/10.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.10"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/100.nasl b/rust/examples/feed/nasl/100.nasl new file mode 100644 index 000000000..899f2bd91 --- /dev/null +++ b/rust/examples/feed/nasl/100.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.100"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/11.nasl b/rust/examples/feed/nasl/11.nasl new file mode 100644 index 000000000..fc37db7c6 --- /dev/null +++ b/rust/examples/feed/nasl/11.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.11"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/12.nasl b/rust/examples/feed/nasl/12.nasl new file mode 100644 index 000000000..e15856330 --- /dev/null +++ b/rust/examples/feed/nasl/12.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.12"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/13.nasl b/rust/examples/feed/nasl/13.nasl new file mode 100644 index 000000000..7de556a20 --- /dev/null +++ b/rust/examples/feed/nasl/13.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.13"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/14.nasl b/rust/examples/feed/nasl/14.nasl new file mode 100644 index 000000000..d31ffdd84 --- /dev/null +++ b/rust/examples/feed/nasl/14.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.14"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/15.nasl b/rust/examples/feed/nasl/15.nasl new file mode 100644 index 000000000..0e02f605a --- /dev/null +++ b/rust/examples/feed/nasl/15.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.15"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/16.nasl b/rust/examples/feed/nasl/16.nasl new file mode 100644 index 000000000..011fa8475 --- /dev/null +++ b/rust/examples/feed/nasl/16.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.16"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/17.nasl b/rust/examples/feed/nasl/17.nasl new file mode 100644 index 000000000..472a1a0b8 --- /dev/null +++ b/rust/examples/feed/nasl/17.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.17"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/18.nasl b/rust/examples/feed/nasl/18.nasl new file mode 100644 index 000000000..3f3325177 --- /dev/null +++ b/rust/examples/feed/nasl/18.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.18"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/19.nasl b/rust/examples/feed/nasl/19.nasl new file mode 100644 index 000000000..bf1aab026 --- /dev/null +++ b/rust/examples/feed/nasl/19.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.19"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/2.nasl b/rust/examples/feed/nasl/2.nasl new file mode 100644 index 000000000..4dd52d5ab --- /dev/null +++ b/rust/examples/feed/nasl/2.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.2"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/20.nasl b/rust/examples/feed/nasl/20.nasl new file mode 100644 index 000000000..450fae969 --- /dev/null +++ b/rust/examples/feed/nasl/20.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.20"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/21.nasl b/rust/examples/feed/nasl/21.nasl new file mode 100644 index 000000000..25e792f08 --- /dev/null +++ b/rust/examples/feed/nasl/21.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.21"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/22.nasl b/rust/examples/feed/nasl/22.nasl new file mode 100644 index 000000000..1c8abf1f2 --- /dev/null +++ b/rust/examples/feed/nasl/22.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.22"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/23.nasl b/rust/examples/feed/nasl/23.nasl new file mode 100644 index 000000000..a3ac8aabb --- /dev/null +++ b/rust/examples/feed/nasl/23.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.23"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/24.nasl b/rust/examples/feed/nasl/24.nasl new file mode 100644 index 000000000..69236ce34 --- /dev/null +++ b/rust/examples/feed/nasl/24.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.24"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/25.nasl b/rust/examples/feed/nasl/25.nasl new file mode 100644 index 000000000..53a070b5d --- /dev/null +++ b/rust/examples/feed/nasl/25.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.25"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/26.nasl b/rust/examples/feed/nasl/26.nasl new file mode 100644 index 000000000..221516e20 --- /dev/null +++ b/rust/examples/feed/nasl/26.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.26"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/27.nasl b/rust/examples/feed/nasl/27.nasl new file mode 100644 index 000000000..979da9ef4 --- /dev/null +++ b/rust/examples/feed/nasl/27.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.27"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/28.nasl b/rust/examples/feed/nasl/28.nasl new file mode 100644 index 000000000..e940218c1 --- /dev/null +++ b/rust/examples/feed/nasl/28.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.28"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/29.nasl b/rust/examples/feed/nasl/29.nasl new file mode 100644 index 000000000..2ac824f28 --- /dev/null +++ b/rust/examples/feed/nasl/29.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.29"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/3.nasl b/rust/examples/feed/nasl/3.nasl new file mode 100644 index 000000000..af1986c94 --- /dev/null +++ b/rust/examples/feed/nasl/3.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.3"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/30.nasl b/rust/examples/feed/nasl/30.nasl new file mode 100644 index 000000000..4c71816f7 --- /dev/null +++ b/rust/examples/feed/nasl/30.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.30"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/31.nasl b/rust/examples/feed/nasl/31.nasl new file mode 100644 index 000000000..436cd5c66 --- /dev/null +++ b/rust/examples/feed/nasl/31.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.31"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/32.nasl b/rust/examples/feed/nasl/32.nasl new file mode 100644 index 000000000..d7cd8893b --- /dev/null +++ b/rust/examples/feed/nasl/32.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.32"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/33.nasl b/rust/examples/feed/nasl/33.nasl new file mode 100644 index 000000000..77a1a678b --- /dev/null +++ b/rust/examples/feed/nasl/33.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.33"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/34.nasl b/rust/examples/feed/nasl/34.nasl new file mode 100644 index 000000000..bde45d8c6 --- /dev/null +++ b/rust/examples/feed/nasl/34.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.34"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/35.nasl b/rust/examples/feed/nasl/35.nasl new file mode 100644 index 000000000..b9cff4d53 --- /dev/null +++ b/rust/examples/feed/nasl/35.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.35"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/36.nasl b/rust/examples/feed/nasl/36.nasl new file mode 100644 index 000000000..6e34bd9de --- /dev/null +++ b/rust/examples/feed/nasl/36.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.36"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/37.nasl b/rust/examples/feed/nasl/37.nasl new file mode 100644 index 000000000..a5bff0508 --- /dev/null +++ b/rust/examples/feed/nasl/37.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.37"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/38.nasl b/rust/examples/feed/nasl/38.nasl new file mode 100644 index 000000000..bcb735ca6 --- /dev/null +++ b/rust/examples/feed/nasl/38.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.38"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/39.nasl b/rust/examples/feed/nasl/39.nasl new file mode 100644 index 000000000..b9b18b752 --- /dev/null +++ b/rust/examples/feed/nasl/39.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.39"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/4.nasl b/rust/examples/feed/nasl/4.nasl new file mode 100644 index 000000000..326e670c9 --- /dev/null +++ b/rust/examples/feed/nasl/4.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.4"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/40.nasl b/rust/examples/feed/nasl/40.nasl new file mode 100644 index 000000000..a1949a5d5 --- /dev/null +++ b/rust/examples/feed/nasl/40.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.40"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/41.nasl b/rust/examples/feed/nasl/41.nasl new file mode 100644 index 000000000..7741946c4 --- /dev/null +++ b/rust/examples/feed/nasl/41.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.41"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/42.nasl b/rust/examples/feed/nasl/42.nasl new file mode 100644 index 000000000..8d591db7f --- /dev/null +++ b/rust/examples/feed/nasl/42.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.42"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/43.nasl b/rust/examples/feed/nasl/43.nasl new file mode 100644 index 000000000..5b5380659 --- /dev/null +++ b/rust/examples/feed/nasl/43.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.43"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/44.nasl b/rust/examples/feed/nasl/44.nasl new file mode 100644 index 000000000..9be9be086 --- /dev/null +++ b/rust/examples/feed/nasl/44.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.44"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/45.nasl b/rust/examples/feed/nasl/45.nasl new file mode 100644 index 000000000..23338d878 --- /dev/null +++ b/rust/examples/feed/nasl/45.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.45"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/46.nasl b/rust/examples/feed/nasl/46.nasl new file mode 100644 index 000000000..d60ef0ad3 --- /dev/null +++ b/rust/examples/feed/nasl/46.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.46"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/47.nasl b/rust/examples/feed/nasl/47.nasl new file mode 100644 index 000000000..7b3769526 --- /dev/null +++ b/rust/examples/feed/nasl/47.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.47"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/48.nasl b/rust/examples/feed/nasl/48.nasl new file mode 100644 index 000000000..62ec8b7b4 --- /dev/null +++ b/rust/examples/feed/nasl/48.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.48"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/49.nasl b/rust/examples/feed/nasl/49.nasl new file mode 100644 index 000000000..61657f47b --- /dev/null +++ b/rust/examples/feed/nasl/49.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.49"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/5.nasl b/rust/examples/feed/nasl/5.nasl new file mode 100644 index 000000000..4dca482bc --- /dev/null +++ b/rust/examples/feed/nasl/5.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.5"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/50.nasl b/rust/examples/feed/nasl/50.nasl new file mode 100644 index 000000000..eeefe5c16 --- /dev/null +++ b/rust/examples/feed/nasl/50.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.50"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/51.nasl b/rust/examples/feed/nasl/51.nasl new file mode 100644 index 000000000..836b6b34c --- /dev/null +++ b/rust/examples/feed/nasl/51.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.51"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/52.nasl b/rust/examples/feed/nasl/52.nasl new file mode 100644 index 000000000..56035bfd0 --- /dev/null +++ b/rust/examples/feed/nasl/52.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.52"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/53.nasl b/rust/examples/feed/nasl/53.nasl new file mode 100644 index 000000000..be134c44c --- /dev/null +++ b/rust/examples/feed/nasl/53.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.53"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/54.nasl b/rust/examples/feed/nasl/54.nasl new file mode 100644 index 000000000..57022e317 --- /dev/null +++ b/rust/examples/feed/nasl/54.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.54"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/55.nasl b/rust/examples/feed/nasl/55.nasl new file mode 100644 index 000000000..e622e1f42 --- /dev/null +++ b/rust/examples/feed/nasl/55.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.55"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/56.nasl b/rust/examples/feed/nasl/56.nasl new file mode 100644 index 000000000..6ba61e0d2 --- /dev/null +++ b/rust/examples/feed/nasl/56.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.56"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/57.nasl b/rust/examples/feed/nasl/57.nasl new file mode 100644 index 000000000..2a2cb63e6 --- /dev/null +++ b/rust/examples/feed/nasl/57.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.57"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/58.nasl b/rust/examples/feed/nasl/58.nasl new file mode 100644 index 000000000..b787612ee --- /dev/null +++ b/rust/examples/feed/nasl/58.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.58"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/59.nasl b/rust/examples/feed/nasl/59.nasl new file mode 100644 index 000000000..0750f838f --- /dev/null +++ b/rust/examples/feed/nasl/59.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.59"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/6.nasl b/rust/examples/feed/nasl/6.nasl new file mode 100644 index 000000000..1ffbf4286 --- /dev/null +++ b/rust/examples/feed/nasl/6.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.6"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/60.nasl b/rust/examples/feed/nasl/60.nasl new file mode 100644 index 000000000..75343f925 --- /dev/null +++ b/rust/examples/feed/nasl/60.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.60"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/61.nasl b/rust/examples/feed/nasl/61.nasl new file mode 100644 index 000000000..b2c354913 --- /dev/null +++ b/rust/examples/feed/nasl/61.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.61"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/62.nasl b/rust/examples/feed/nasl/62.nasl new file mode 100644 index 000000000..850c9621f --- /dev/null +++ b/rust/examples/feed/nasl/62.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.62"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/63.nasl b/rust/examples/feed/nasl/63.nasl new file mode 100644 index 000000000..2065c7aea --- /dev/null +++ b/rust/examples/feed/nasl/63.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.63"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/64.nasl b/rust/examples/feed/nasl/64.nasl new file mode 100644 index 000000000..704af5230 --- /dev/null +++ b/rust/examples/feed/nasl/64.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.64"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/65.nasl b/rust/examples/feed/nasl/65.nasl new file mode 100644 index 000000000..7688837f6 --- /dev/null +++ b/rust/examples/feed/nasl/65.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.65"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/66.nasl b/rust/examples/feed/nasl/66.nasl new file mode 100644 index 000000000..f0b950610 --- /dev/null +++ b/rust/examples/feed/nasl/66.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.66"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/67.nasl b/rust/examples/feed/nasl/67.nasl new file mode 100644 index 000000000..6fb014a7f --- /dev/null +++ b/rust/examples/feed/nasl/67.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.67"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/68.nasl b/rust/examples/feed/nasl/68.nasl new file mode 100644 index 000000000..0c00fa1e9 --- /dev/null +++ b/rust/examples/feed/nasl/68.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.68"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/69.nasl b/rust/examples/feed/nasl/69.nasl new file mode 100644 index 000000000..8e692d0ef --- /dev/null +++ b/rust/examples/feed/nasl/69.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.69"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/7.nasl b/rust/examples/feed/nasl/7.nasl new file mode 100644 index 000000000..abb1640ca --- /dev/null +++ b/rust/examples/feed/nasl/7.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.7"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/70.nasl b/rust/examples/feed/nasl/70.nasl new file mode 100644 index 000000000..cac21db56 --- /dev/null +++ b/rust/examples/feed/nasl/70.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.70"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/71.nasl b/rust/examples/feed/nasl/71.nasl new file mode 100644 index 000000000..d8950eeae --- /dev/null +++ b/rust/examples/feed/nasl/71.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.71"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/72.nasl b/rust/examples/feed/nasl/72.nasl new file mode 100644 index 000000000..a4af0038a --- /dev/null +++ b/rust/examples/feed/nasl/72.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.72"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/73.nasl b/rust/examples/feed/nasl/73.nasl new file mode 100644 index 000000000..56c50ad4c --- /dev/null +++ b/rust/examples/feed/nasl/73.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.73"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/74.nasl b/rust/examples/feed/nasl/74.nasl new file mode 100644 index 000000000..ba5260e36 --- /dev/null +++ b/rust/examples/feed/nasl/74.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.74"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/75.nasl b/rust/examples/feed/nasl/75.nasl new file mode 100644 index 000000000..69ecf5fd5 --- /dev/null +++ b/rust/examples/feed/nasl/75.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.75"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/76.nasl b/rust/examples/feed/nasl/76.nasl new file mode 100644 index 000000000..2642247bd --- /dev/null +++ b/rust/examples/feed/nasl/76.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.76"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/77.nasl b/rust/examples/feed/nasl/77.nasl new file mode 100644 index 000000000..dc6dfb11f --- /dev/null +++ b/rust/examples/feed/nasl/77.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.77"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/78.nasl b/rust/examples/feed/nasl/78.nasl new file mode 100644 index 000000000..8cb440e95 --- /dev/null +++ b/rust/examples/feed/nasl/78.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.78"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/79.nasl b/rust/examples/feed/nasl/79.nasl new file mode 100644 index 000000000..ca67c72ee --- /dev/null +++ b/rust/examples/feed/nasl/79.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.79"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/8.nasl b/rust/examples/feed/nasl/8.nasl new file mode 100644 index 000000000..b04b2db80 --- /dev/null +++ b/rust/examples/feed/nasl/8.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.8"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/80.nasl b/rust/examples/feed/nasl/80.nasl new file mode 100644 index 000000000..dc5264953 --- /dev/null +++ b/rust/examples/feed/nasl/80.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.80"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/81.nasl b/rust/examples/feed/nasl/81.nasl new file mode 100644 index 000000000..cde1f0f15 --- /dev/null +++ b/rust/examples/feed/nasl/81.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.81"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/82.nasl b/rust/examples/feed/nasl/82.nasl new file mode 100644 index 000000000..2cd79054a --- /dev/null +++ b/rust/examples/feed/nasl/82.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.82"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/83.nasl b/rust/examples/feed/nasl/83.nasl new file mode 100644 index 000000000..00f2c3a0c --- /dev/null +++ b/rust/examples/feed/nasl/83.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.83"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/84.nasl b/rust/examples/feed/nasl/84.nasl new file mode 100644 index 000000000..cac6d7ba7 --- /dev/null +++ b/rust/examples/feed/nasl/84.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.84"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/85.nasl b/rust/examples/feed/nasl/85.nasl new file mode 100644 index 000000000..1e990f063 --- /dev/null +++ b/rust/examples/feed/nasl/85.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.85"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/86.nasl b/rust/examples/feed/nasl/86.nasl new file mode 100644 index 000000000..7a7f6bba4 --- /dev/null +++ b/rust/examples/feed/nasl/86.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.86"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/87.nasl b/rust/examples/feed/nasl/87.nasl new file mode 100644 index 000000000..3ace58b7e --- /dev/null +++ b/rust/examples/feed/nasl/87.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.87"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/88.nasl b/rust/examples/feed/nasl/88.nasl new file mode 100644 index 000000000..ba7fa52dd --- /dev/null +++ b/rust/examples/feed/nasl/88.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.88"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/89.nasl b/rust/examples/feed/nasl/89.nasl new file mode 100644 index 000000000..794750fbb --- /dev/null +++ b/rust/examples/feed/nasl/89.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.89"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/9.nasl b/rust/examples/feed/nasl/9.nasl new file mode 100644 index 000000000..bfc0fd763 --- /dev/null +++ b/rust/examples/feed/nasl/9.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.9"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/90.nasl b/rust/examples/feed/nasl/90.nasl new file mode 100644 index 000000000..86bb11d57 --- /dev/null +++ b/rust/examples/feed/nasl/90.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.90"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/91.nasl b/rust/examples/feed/nasl/91.nasl new file mode 100644 index 000000000..1cb7e4418 --- /dev/null +++ b/rust/examples/feed/nasl/91.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.91"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/92.nasl b/rust/examples/feed/nasl/92.nasl new file mode 100644 index 000000000..d7f411b85 --- /dev/null +++ b/rust/examples/feed/nasl/92.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.92"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/93.nasl b/rust/examples/feed/nasl/93.nasl new file mode 100644 index 000000000..a2f822663 --- /dev/null +++ b/rust/examples/feed/nasl/93.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.93"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/94.nasl b/rust/examples/feed/nasl/94.nasl new file mode 100644 index 000000000..eb9e613cb --- /dev/null +++ b/rust/examples/feed/nasl/94.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.94"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/95.nasl b/rust/examples/feed/nasl/95.nasl new file mode 100644 index 000000000..afb72f8f3 --- /dev/null +++ b/rust/examples/feed/nasl/95.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.95"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/96.nasl b/rust/examples/feed/nasl/96.nasl new file mode 100644 index 000000000..35eba7a2a --- /dev/null +++ b/rust/examples/feed/nasl/96.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.96"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/97.nasl b/rust/examples/feed/nasl/97.nasl new file mode 100644 index 000000000..7e9ceaa46 --- /dev/null +++ b/rust/examples/feed/nasl/97.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.97"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/98.nasl b/rust/examples/feed/nasl/98.nasl new file mode 100644 index 000000000..39e5650f9 --- /dev/null +++ b/rust/examples/feed/nasl/98.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.98"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/99.nasl b/rust/examples/feed/nasl/99.nasl new file mode 100644 index 000000000..9d8fc4431 --- /dev/null +++ b/rust/examples/feed/nasl/99.nasl @@ -0,0 +1,19 @@ +if (description) +{ + script_oid("0.0.0.0.0.0.0.0.0.99"); + script_version("2023-02-23T13:33:44+0000"); + script_tag(name:"last_modification", value:"2020-12-07 13:33:44 +0000 (Mon, 07 Dec 2020)"); + script_tag(name:"creation_date", value:"2009-05-12 22:04:51 +0200 (Tue, 12 May 2009)"); + script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N"); + script_name("Application Server Detection (HTTP)"); + script_category(ACT_GATHER_INFO); + script_tag(name:"qod_type", value:"remote_banner"); + script_family("Product detection"); + script_copyright("Copyright (C) 2023 Greenbone AG"); + script_require_ports("Services/www", 6262); + script_exclude_keys("Settings/disable_cgi_scanning"); + script_tag(name:"summary", value:"HTTP AS detection"); + script_xref(name:"URL", value:"https://greenbone.net"); + exit(0); +} +exit(42); diff --git a/rust/examples/feed/nasl/plugin_feed_info.inc b/rust/examples/feed/nasl/plugin_feed_info.inc new file mode 100644 index 000000000..e16bbe7d8 --- /dev/null +++ b/rust/examples/feed/nasl/plugin_feed_info.inc @@ -0,0 +1,5 @@ +PLUGIN_SET = "0.0.1"; +PLUGIN_FEED = "testus apparatus"; +FEED_VENDOR = "Greenbone AG"; +FEED_HOME = "https://www.greenbone.net"; +FEED_NAME = "testus"; diff --git a/rust/examples/feed/nasl/sha256sums b/rust/examples/feed/nasl/sha256sums new file mode 100644 index 000000000..fa141fc7f --- /dev/null +++ b/rust/examples/feed/nasl/sha256sums @@ -0,0 +1,101 @@ +e39d088df5527aad59ac29cdad03e80abc0033de9f19cce0a8235e8e502adc39 1.nasl +fcefa25539751b19a0374529f82536fd9400a668ecb5f1a94e643c861586286c 2.nasl +1c25f19ca5726d171febb04933825edfff17d6b4492e50457ab4dcd5af150afb 3.nasl +e9b9e0181bb5ca997ef3aa8b5e0aa666e4bd3b55bf550bb2ab835229f45ae80d 4.nasl +eb82a9b9fc539090def471e58f59e88923239efcf5c41a9a7de94f3af69802f6 5.nasl +1c0ad44d5cea91b1a8e9a0ecfeb1ef7fee4a7090843094602b3148f2a1653bd8 6.nasl +5f198dc9016f6296b705d47c07f57db83189887ff02e24a75d4a2faac708e541 7.nasl +62ce2341f79446b490d6bc4f25683365ebd7f9db06d11bb73bc702250a532554 8.nasl +1da09ec91a653d7a71d9d52f3b9b152eeb9d764d2e3a49ff4d5d1b6a56070433 9.nasl +5ecdd3b89330865671e33cd81709c28e845cf5463afe6e3f8f5b816b5b84140d 10.nasl +f3722f3618cc1cba2dee62ad7e3d351d4201b72c20a1fa4c0e76960b4bd5b3d4 11.nasl +092101b303182a875b3d18c7842b0851dfa8f72fffab7afa0b85347880be4d35 12.nasl +18e419b86116df444adc5d16e1f84622b806f1e6dbbcd72460628b6d34da5b58 13.nasl +7f866150fda696aa1ec7e7e431020ea97f3d68bb1baee899168d422b2ec2369d 14.nasl +374551f1f1508cbd8f05eb3c61a62938e0303efc1bbcaea3113cfe2eda946cc2 15.nasl +656f23cb496743912bcb4aba2cf02b097da30171f98d0e06193a0190ce9b8cd5 16.nasl +d33910597bcfc05cef2f7e192d0fb4e9998d072a8b6fdc80d334d361d857e01d 17.nasl +191241f2edb0cf787a2404ec0ec6f92574d12da463634e4f287dd6e3504c6f24 18.nasl +6ce24f24e1cd51cae33cf625cd1d896cea96f1fb506d4d342ae17288338d448f 19.nasl +40939e1421900d00d6390b903bd0c88e81ae724d1aee13e5fe8357ed5fda60c8 20.nasl +bb9fae258d251f74c28f9b6eef7f2cc471312e944a1e4a5e6bb44911e8b96768 21.nasl +17809a14e56caca111127524d5cba20963fe295ff3a89f8473efc1b98fed4899 22.nasl +75d2992976cfdfc6448b45a6f220ad37f06861eb05616a9848edfa00d101ede2 23.nasl +46083eaf758c0c6ff8f4ef5177a295a76a88195123c61039f2bfc1cbc7a030e2 24.nasl +f42d310cb5b2c99858b0f621c97388d9819b4d9519219453c55ee92788b2be64 25.nasl +fc32cdadec271f7b2c7f65bf97e945c5d65d44edabec720777944498f19d3561 26.nasl +f962a5f5a027241e911afc61570f8c8db1785e661844644706bbdfbdc25f4b67 27.nasl +de475dd69341874dd2c20fa458dd3416293dee2f890bab62f597a5650edcebdd 28.nasl +a65d5cf0eeeaf166d4a9087fd8c304115feb4634ebadfa6e12da80596634d8a8 29.nasl +c08bae89dbe54d68552d981fee72a5281315f06abeb50a9634197bdddbe134e5 30.nasl +2ee61f873e4bb107efb47418097e50fa5604d5c07d6f0cb0501f067367f3d35b 31.nasl +e232d164477f49ebf7f4f6e45967fd71204a0be2ac175538effb2dc30217e538 32.nasl +82afc29941e7a5e1e2fb8ac44a9bb3b68e03a83e59918a45833e5bbd0b6ffd2e 33.nasl +01c5ab94f21c6f33c85fe72eaa3cd882e3a9fdaf2d83c9859f63e8c0fcb4e8bb 34.nasl +384caacc791eea4480de26aaf3a6d2bad9eb44f7b7d2bdb2445d08fdc3aff0f3 35.nasl +a2f03c433a37b81d8ed119186b960fcfd651e4b3fa80592693215ad15fa98c4a 36.nasl +48789306e2860b8fac7e0e2c16d06f9b28bead203e45e2ab8844ae90f515ba52 37.nasl +2cfec815a0a87feae98493d9b08778937a9cfce19d855ccc167dfc9fbe60f703 38.nasl +d29e6ad7fcca5e0503472cee6ce23a569b556af87c0ed43b0da7be8b9f5caf1d 39.nasl +1313f735daf84024544b5f7b0afbd34ecb72746450170b34c591ae140f950c76 40.nasl +d5471ab323f937b332d549b8d48a21a22c0b8712b7be37fbfdc9f4c1b7bfff09 41.nasl +72ea70e8daaa6784f88182042958baf3ba12d530141d25cc46684f29141f98a9 42.nasl +19f0a0068770eeb89994e40982f6a56e4f89b6352d8fd7cc70edb9b7e54bc9ad 43.nasl +a72b1af5a7e576558633990f1af452865cfa2fd14484aff536d6c7625826e8bd 44.nasl +7b3a24c9e3db790a00257f0e3b8a8f8fb2e71637eaa035b65acb19950e625734 45.nasl +d2efe5f4d6a0c46d2023953b22fc1bbe8093b2abed7b2de3a32a5b171d7cc6e6 46.nasl +d11835abb9bd20898311a20db471bdfc26901f0b667335ea1847f3ef34dad6a1 47.nasl +2178b60316196f76993baf33d9dea1f459261c791a636224d6ff464cfa835782 48.nasl +e7b7b00ab2337cf4c63d9ee36fa871a9931e0b828f4b3af0ecf8af757666ae9e 49.nasl +736ba0bddc701240f4a686bee47374af6a4215067a7476949a34d73d946cb241 50.nasl +1359a4cd59c44a232ec4a7d1b5fb8ea39e3d4fd4e7d4030097344ef611f5ea4d 51.nasl +469eeb53c09c48aeb204d2cf8e040ff28f66ebe15cff7baa6ff7ef007751606a 52.nasl +45b5f50b7160a8f1d3184e6bc4eb96ab03361139282cc65af72410cfa180b2b9 53.nasl +99f62e7a0761fab64f5ddce0fb1f1bd252d5c5a9bb502d2348d5f64a41c998de 54.nasl +92bd775fe90c1d167803f2b29f34720decc0642e044d1da3960c669012fdcec0 55.nasl +ce6de3c69bb42575959794a2d1ee3275a6c70d8159c46350589bcbbd94b6960e 56.nasl +0fbd080d49319b396de5e7e1ac6edda0fd015c3c6bc9fdd3b8663e745eb415d5 57.nasl +4394f45673b9dd4ec15f2b0aaf708b5706e4a960f5a7187c80bb7455667e4310 58.nasl +7ba79cdc1271524a8a2c1ab3db21692e6b69516193c587f1504fd754a702d67d 59.nasl +778311edc489b75a76c782f4cfedf925cd6fbee3d7ec14902768356949cd918d 60.nasl +f4f7f74308afaa54d0390963a79ab6a613e498b390b7c89a4c59e7021eefdab9 61.nasl +e3331c595c10daa49e65fbf15b810965898604e0b1d472e8f712b316cd76bc7a 62.nasl +f02ed14d603fab33f93516612cce090be5128df3830b5fc2ef4d15ce25d3116d 63.nasl +a268c8d63b9aad2ca2e97ee5f284913f882eb70eafc4dfcfbe4dae8e3f3cccc7 64.nasl +b80b3b5788ee2610cfba8fd88f6303e0c32af14d75af9b107397c6d67ee29795 65.nasl +41d5a3a3eb3189c2eca12ec898eb395d1864a82ec53b4e2166c3b492d2499d41 66.nasl +8be3c9181da3d091a2ec02a762cac059366e80975cb5eb4a6bd4258d461103ed 67.nasl +0ef1514ba3fbfc1f5de9edce114041b25fbc40344e212f18e25e26dca5048d7c 68.nasl +78f50864330a11f3aa711e94e3c6d36a704dcfa541ddb02c24a4dff5f31308f2 69.nasl +aca0f2adfa9385505bdc020f12e8d0a1928171945349147c1ae24e4bbb87842b 70.nasl +addb10056e98ce4256ca7489cf9a9ed7f8442f54e4d52d27e09023a45d48085e 71.nasl +ddde6a455c76958144be52375bb41f8aa698a9d357d7298303cc9b73eb3b7588 72.nasl +54df0c2470384e05fa3017ee26d6e3b97e8dc9c53037354a6516e93fe87f4bf8 73.nasl +9766bd51fc3a0908ee59b4554211cee265384afcdb4a2de3d18cb4c6cf98f0c6 74.nasl +cc66a4cae5a51bab94104d4ef245038336e29eea50a732c80d702bef9a327f4d 75.nasl +ff74de4cbb6882553e6e354a0696bad6a993ef561761d1845cdb8dc7f5d55443 76.nasl +b00389cd7e695524ede154de7df7b6bdc0fe579dfb2f3353d045aaab5cf2ff9c 77.nasl +aa90cdfbc9186c40334d5e147b12f32d45ef805578eb358255cb9a4b184b5e15 78.nasl +8ca756768db60470301f01a37296a8eed6b9e0450b82102815bddee9bc2e25da 79.nasl +01609211f930a47fde3a39ed67dbc5c2168597adc0ae59dff2d3c2be82385506 80.nasl +44d14b2400e3c708f4c1df023bc0b46c16a97090e853d289ceb8f69d5b6014c8 81.nasl +633b42f6c0c8fb11a325b30a632080cb84bd72e87a7586ebef0d24130b7aa74f 82.nasl +8cd841bdbffdac0ca16e5667006406371bf694fb596f6322252c253a1ed15ec3 83.nasl +1d04f2f5b070a2b026c21227b8b733946068bdfc59eb2008dc2c4a04641c122d 84.nasl +56632a468a2773a7996179464e56d1aa79738afe2a4ec6848977950bc6a62111 85.nasl +2d2f4e8bc4fd4119205b91ad220177c9309a0d5746a96548d8adaeddc3c9d424 86.nasl +25364ab14bc05a6ba13468afd51648d420c3fb95e89ea8cbb844b72f24b197ed 87.nasl +45becde255597b8c05f57ddd0e278d35c2d1e25fb8a859f2737ffc3eb57c4f68 88.nasl +35adce90515dfdcb54bdb6593d62e152c9c8734f718ffccd5109fadce97126c0 89.nasl +cf25faf974c12939b3179a3d4cc46159219b68dee7843179d458248efaa50096 90.nasl +3b2c20392a3dd1bbb26e4d001f1c043858d196f197f78906dc179013571d2a62 91.nasl +1174bce7eb36764a2f25e61471be6bd4496295d859f27725217b657fbcb20c00 92.nasl +437ba1300538ea6aba5f117f08f70cb85e8997f45da1973a5f471b9d7b0eada0 93.nasl +65cf4eea5206b0a146e7fec5e3ea549cd815477c527ffa0bdbdbe848d12cb576 94.nasl +f5e1cab9cb6bc80694bff937e26d514eedc2f3084d6bc34607bcb47677c75e1d 95.nasl +1a1572b4f07ffbfedba0b8984d6760a5e270b2338584a5205fb64cf7c6c74605 96.nasl +d32deba2bbe5828cafba0fd1448293164dd3ff82b2d008ebdd4e7f964b35a625 97.nasl +8b7303f2f09a684ad8139d488a8d61f6c4f28f27bdc69f55a8f78be0cf92ee71 98.nasl +50d7e763cb8cfb18460ba9cd487760a64280de2874140bb7b3b9aaf2e322f018 99.nasl +d060ca66cc4f21469a63a539c53123f9eee9363b152a8fa4858c86d27e680a53 100.nasl +2e21d3f6973e02e74ebc10dcc4ca77e7fbe414d6a8b985b2e0cda0111199a6aa plugin_feed_info.inc diff --git a/rust/examples/feed/notus/advisories/sha256sums b/rust/examples/feed/notus/advisories/sha256sums new file mode 100644 index 000000000..ff27214ba --- /dev/null +++ b/rust/examples/feed/notus/advisories/sha256sums @@ -0,0 +1 @@ +008d57e47ad9096a69c1f8445662dec747993fb22517a5f786f4bb29eb18f9c4 test.notus diff --git a/rust/examples/feed/notus/advisories/test.notus b/rust/examples/feed/notus/advisories/test.notus new file mode 100644 index 000000000..09edd608b --- /dev/null +++ b/rust/examples/feed/notus/advisories/test.notus @@ -0,0 +1,26 @@ +{ + "version": "1.2", + "spdx-license-identifier": "GPL-2.0-only", + "copyright": "Copyright (C) 2008-2024 Greenbone Networks GmbH", + "family": "Test Local Security Checks", + "advisories": [ + { + "oid": "1.3.6.1.4.1.25623.1.1.1.2.2024.3731", + "title": "Test: Security Advisory (DLA-3731-1)", + "creation_date": 1706847576, + "last_modification": 1706847576, + "advisory_id": "TEST-3731-1", + "advisory_xref": "https://www.greenbone.net", + "cves": [], + "summary": "The remote host is missing an update for the Test 'man-db' package(s) announced via the DLA-3731-1 advisory.", + "affected": "'man-db' package(s) on Test 10.", + "xrefs": [], + "qod_type": "package", + "severity": { + "origin": "Greenbone", + "date": 1706847576, + "cvss_v2": "AV:N/AC:L/Au:N/C:P/I:N/A:N" + } + } + ] +} diff --git a/rust/examples/feed/notus/products/sha256sums b/rust/examples/feed/notus/products/sha256sums new file mode 100644 index 000000000..df948b4c0 --- /dev/null +++ b/rust/examples/feed/notus/products/sha256sums @@ -0,0 +1 @@ +720805198332ce39e5f113bbc56b4effd337ddc350f0571e63d8fc069049007b test.notus diff --git a/rust/examples/feed/notus/products/test.notus b/rust/examples/feed/notus/products/test.notus new file mode 100644 index 000000000..c89be5245 --- /dev/null +++ b/rust/examples/feed/notus/products/test.notus @@ -0,0 +1,19 @@ +{ + "version": "1.2", + "spdx-license-identifier": "GPL-2.0-only", + "copyright": "Copyright (C) 2008-2024 Greenbone Networks GmbH", + "package_type": "deb", + "product_name": "Test", + "advisories": [ + { + "oid": "1.3.6.1.4.1.25623.1.1.1.2.2024.3731", + "fixed_packages": [ + { + "name": "man-db", + "full_version": "2.8.5-2+deb10u1", + "specifier": ">=" + } + ] + } + ] +} diff --git a/rust/examples/openvasd/config.example.toml b/rust/examples/openvasd/config.example.toml index 27611c587..88eb666cc 100644 --- a/rust/examples/openvasd/config.example.toml +++ b/rust/examples/openvasd/config.example.toml @@ -50,12 +50,20 @@ address = "127.0.0.1:3000" level = "INFO" [storage] -# can be either fs (file system) or inmemory (in memory). +# can be either fs (file system), redis or inmemory (in memory). # If it is set to fs is highly recommended to set `STORAGE_KEY` in the env variable. # WARNING: if the type is set to fs and no encryption key is set then the data is stored unencrypted. +# As long as legacy openvas is required redis is recommended #type = "fs" +#type = "redis" type = "inmemory" +[storage.redis] +# set the redis url. When socket is used it has to start with `unix://` +# if a username and password is required it also needs to set in the url: +# redis://user:pass@localhost:6379 +url = "redis://localhost:6379" + [storage.fs] # Sets the storage root directory if the storage.type is set to `fs`. path = "/var/lib/openvasd/storage" @@ -66,3 +74,5 @@ path = "/var/lib/openvasd/storage" [notus] # path to the notus feed. This is required for the /notus endpoint. products_path = "/var/lib/notus/products/" +# path to the notus advisories feed. This is required for the /vts endpoint. +advisories_path = "/var/lib/notus/advisories/" diff --git a/rust/feed/src/lib.rs b/rust/feed/src/lib.rs index 55f325468..843e27c3b 100644 --- a/rust/feed/src/lib.rs +++ b/rust/feed/src/lib.rs @@ -7,7 +7,7 @@ mod oid; pub mod transpile; mod update; -mod verify; +pub mod verify; pub use oid::Oid; pub use update::feed_version as version; diff --git a/rust/feed/src/update/error.rs b/rust/feed/src/update/error.rs index b94532588..9ed780799 100644 --- a/rust/feed/src/update/error.rs +++ b/rust/feed/src/update/error.rs @@ -34,6 +34,30 @@ pub struct Error { pub kind: ErrorKind, } + +impl std::fmt::Display for ErrorKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ErrorKind::InterpretError(e) => write!(f, "Interpret Error: {}", e), + ErrorKind::SyntaxError(e) => write!(f, "Syntax Error: {}", e), + ErrorKind::StorageError(e) => write!(f, "Storage Error: {}", e), + ErrorKind::LoadError(e) => write!(f, "Load Error: {}", e), + ErrorKind::MissingExit(message) => write!(f, "Missing Exit: {}", message), + ErrorKind::VerifyError(e) => write!(f, "Verify Error: {}", e), + } + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Error with key '{}': {}", self.key, self.kind) + } +} + +impl std::error::Error for Error {} + + + impl From for Error { fn from(value: verify::Error) -> Self { let fin = match &value { diff --git a/rust/feed/src/update/mod.rs b/rust/feed/src/update/mod.rs index 34c76fbe5..55a6bb575 100644 --- a/rust/feed/src/update/mod.rs +++ b/rust/feed/src/update/mod.rs @@ -40,7 +40,7 @@ impl From for ErrorKind { } } /// Loads the plugin_feed_info and returns the feed version -pub fn feed_version>( +pub fn feed_version + 'static>( loader: &dyn Loader, dispatcher: &dyn Dispatcher, ) -> Result { @@ -82,7 +82,7 @@ where impl<'a, S, L, V, K, R> Update where S: Sync + Send + Dispatcher, - K: AsRef + Display + Default + From, + K: AsRef + Display + Default + From + 'static, L: Sync + Send + Loader + AsBufReader, V: Iterator, verify::Error>>, R: Read + 'a, @@ -175,7 +175,7 @@ where pub fn verify_signature(&self) -> Result<(), verify::Error> { //self::SignatureChecker::signature_check(&path) let path = self.loader.root_path().unwrap(); - as self::SignatureChecker>::signature_check(&path) + crate::verify::check_signature(&path) } } @@ -185,7 +185,7 @@ where L: Sync + Send + Loader + AsBufReader, V: Iterator, verify::Error>>, R: Read + 'a, - K: AsRef + Display + Default + From, + K: AsRef + Display + Default + From + 'static, { type Item = Result; diff --git a/rust/feed/src/verify/mod.rs b/rust/feed/src/verify/mod.rs index 0ba34328a..7ac639c04 100644 --- a/rust/feed/src/verify/mod.rs +++ b/rust/feed/src/verify/mod.rs @@ -14,6 +14,7 @@ use std::{ fmt::Display, fs::File, io::{self, BufRead, BufReader, Read}, + path::Path, }; use hex::encode; @@ -165,53 +166,62 @@ impl VerificationHelper for VHelper { Ok(()) } } + +/// For signature check the GNUPGHOME environment variable +/// must be set with the path to the keyring. +/// If this is satisfied, the signature check is performed +pub fn check_signature

(path: &P) -> Result<(), Error> +where + P: AsRef + ?Sized, +{ + let mut gnupghome = match std::env::var("GNUPGHOME") { + Ok(v) => v, + Err(_) => { + return Err(Error::MissingKeyring); + } + }; + gnupghome.push_str("/pubring.kbx"); + + let helper = VHelper::new(gnupghome); + + let sign_path = path.as_ref().to_path_buf().join("sha256sums.asc"); + let mut sig_file = File::open(sign_path).unwrap(); + let mut signature = Vec::new(); + let _ = sig_file.read_to_end(&mut signature); + + let data_path = path.as_ref().to_path_buf().join("sha256sums"); + let mut data_file = File::open(data_path).unwrap(); + let mut data = Vec::new(); + let _ = data_file.read_to_end(&mut data); + + let v = match DetachedVerifierBuilder::from_bytes(&signature[..]) { + Ok(v) => v, + Err(_) => { + return Err(Error::BadSignature( + "Signature verification failed".to_string(), + )); + } + }; + + let p = &StandardPolicy::new(); + if let Ok(mut verifier) = v.with_policy(p, None, helper) { + match verifier.verify_bytes(data) { + Ok(_) => return Ok(()), + Err(e) => return Err(Error::BadSignature(e.to_string())), + } + }; + Err(Error::BadSignature( + "Signature verification failed".to_string(), + )) +} + /// Trait for signature check pub trait SignatureChecker { /// For signature check the GNUPGHOME environment variable /// must be set with the path to the keyring. /// If this is satisfied, the signature check is performed fn signature_check(feed_path: &str) -> Result<(), Error> { - let mut gnupghome = match std::env::var("GNUPGHOME") { - Ok(v) => v, - Err(_) => { - return Err(Error::MissingKeyring); - } - }; - gnupghome.push_str("/pubring.kbx"); - - let helper = VHelper::new(gnupghome); - - let mut sign_path = feed_path.to_owned(); - sign_path.push_str("/sha256sums.asc"); - let mut sig_file = File::open(sign_path).unwrap(); - let mut signature = Vec::new(); - let _ = sig_file.read_to_end(&mut signature); - - let mut data_path = feed_path.to_owned(); - data_path.push_str("/sha256sums"); - let mut data_file = File::open(data_path).unwrap(); - let mut data = Vec::new(); - let _ = data_file.read_to_end(&mut data); - - let v = match DetachedVerifierBuilder::from_bytes(&signature[..]) { - Ok(v) => v, - Err(_) => { - return Err(Error::BadSignature( - "Signature verification failed".to_string(), - )); - } - }; - - let p = &StandardPolicy::new(); - if let Ok(mut verifier) = v.with_policy(p, None, helper) { - match verifier.verify_bytes(data) { - Ok(_) => return Ok(()), - Err(e) => return Err(Error::BadSignature(e.to_string())), - } - }; - Err(Error::BadSignature( - "Signature verification failed".to_string(), - )) + check_signature(feed_path) } } @@ -335,6 +345,7 @@ where } } +/// Contains all information necessary to do a hash sum check pub struct HashSumFileItem<'a, R> { file_name: String, hashsum: String, @@ -343,6 +354,7 @@ pub struct HashSumFileItem<'a, R> { } impl<'a, R: Read> HashSumFileItem<'a, R> { + /// Verifies Hashsum pub fn verify(&self) -> Result<(), Error> { let hashsum = self.hasher.hash( &mut self.reader.as_bufreader(&self.file_name)?, @@ -358,10 +370,12 @@ impl<'a, R: Read> HashSumFileItem<'a, R> { Ok(()) } + /// returns file name pub fn get_filename(&self) -> String { self.file_name.clone() } + /// returns hash sum pub fn get_hashsum(&self) -> String { self.hashsum.clone() } diff --git a/rust/infisto/Cargo.toml b/rust/infisto/Cargo.toml index 1a8422f25..41cedca2d 100644 --- a/rust/infisto/Cargo.toml +++ b/rust/infisto/Cargo.toml @@ -14,6 +14,7 @@ rand = "0" chacha20 = "0" pbkdf2 = { version = "0", features = ["password-hash"] } sha2 = "0" +rmp-serde = "1.1.2" [dev-dependencies] criterion = "0" diff --git a/rust/infisto/src/base.rs b/rust/infisto/src/base.rs index 11949a00d..86f04874d 100644 --- a/rust/infisto/src/base.rs +++ b/rust/infisto/src/base.rs @@ -311,7 +311,8 @@ impl IndexedByteStorage for IndexedFileStorer { if data.is_empty() { return Ok(()); } - match self.load_index(key) { + let result = self.load_index(key); + match result { Ok(i) => self.append_all_index(key, &i, data).map(|_| ()), Err(Error::FileOpen(ioe)) => match ioe { std::io::ErrorKind::NotFound => { @@ -474,7 +475,8 @@ impl IndexedByteStorage for CachedIndexFileStorer { let (ci, result) = if let Some((ci, fi)) = self.find_index(key) { (ci, self.base.append_all_index(key, fi, data)?) } else { - match self.base.load_index(key) { + let result = self.base.load_index(key); + match result { Ok(i) => ( self.cache.len() - 1, self.base.append_all_index(key, &i, data)?, @@ -488,7 +490,12 @@ impl IndexedByteStorage for CachedIndexFileStorer { .append_all_index(key, &initial_index, &data[1..])?; (self.cache.len() - 1, end_index) } - _ => return Err(Error::FileOpen(ioe)), + std::io::ErrorKind::NotFound if data.is_empty() => { + (0, vec![]) + } + _ => { + return Err(Error::FileOpen(ioe)) + }, }, Err(e) => return Err(e), } diff --git a/rust/infisto/src/serde.rs b/rust/infisto/src/serde.rs index b303b3ca3..29bbb97c2 100644 --- a/rust/infisto/src/serde.rs +++ b/rust/infisto/src/serde.rs @@ -18,9 +18,8 @@ where { /// Serializes given data to Vec pub fn serialize(t: T) -> Result { - let config = bincode::config::standard(); - match bincode::serde::encode_to_vec(&t, config) { + match rmp_serde::to_vec(&t) { Ok(v) => Ok(Serialization::Serialized(v)), Err(_) => Err(base::Error::Serialize), } @@ -42,9 +41,8 @@ where type Error = base::Error; fn try_from(value: Vec) -> Result { - let config = bincode::config::standard(); - match bincode::serde::decode_from_slice(&value, config) { - Ok((t, _)) => Ok(Serialization::Deserialized(t)), + match rmp_serde::from_slice(&value) { + Ok(t) => Ok(Serialization::Deserialized(t)), Err(_) => Err(base::Error::Serialize), } } diff --git a/rust/json-storage/README.md b/rust/json-storage/README.md index 967ec6d96..2830f5be3 100644 --- a/rust/json-storage/README.md +++ b/rust/json-storage/README.md @@ -72,11 +72,11 @@ Transforms a NVT to the json structure: ### Element -To create a single json element per dispatch you can use the NvtDispatcher with a writer of your choice: +To create a single json element per dispatch you can use the ItemDispatcher with a writer of your choice: ``` let mut buf = Vec::with_capacity(1208); -let dispatcher = json_storage::NvtDispatcher::as_dispatcher::(&mut buf); +let dispatcher = json_storage::ItemDispatcher::as_dispatcher::(&mut buf); ``` ### Array @@ -86,7 +86,7 @@ To create an array for elements per dispatch call: ``` let mut buf = Vec::with_capacity(1208); let mut ja = json_storage::ArrayWrapper::new(&mut buf); -let dispatcher = json_storage::NvtDispatcher::as_dispatcher::(&mut ja); +let dispatcher = json_storage::ItemDispatcher::as_dispatcher::(&mut ja); // do your work ja.end(); ``` diff --git a/rust/json-storage/src/lib.rs b/rust/json-storage/src/lib.rs index 0d08067b1..1c584a682 100644 --- a/rust/json-storage/src/lib.rs +++ b/rust/json-storage/src/lib.rs @@ -10,7 +10,7 @@ use std::{ sync::{Arc, Mutex}, }; -use storage::{self, item::PerItemDispatcher, Kb, StorageError}; +use storage::{self, item::PerItemDispatcher, Kb, StorageError, NotusAdvisory}; /// Wraps write calls of json elements to be as list. /// @@ -124,38 +124,46 @@ where kbs.push(kb); Ok(()) } + + fn dispatch_advisory( + &self, + _: &str, + + _: Box>, + ) -> Result<(), StorageError> { + Ok(()) + } } impl storage::Retriever for ItemDispatcher where S: Write, + K: 'static { fn retrieve( &self, _: &K, - scope: &storage::Retrieve, - ) -> Result, StorageError> { + scope: storage::Retrieve, + ) -> Result>, StorageError> { Ok(match scope { // currently not supported - storage::Retrieve::NVT(_) => Vec::new(), - storage::Retrieve::NOTUS(_) => Vec::new(), - storage::Retrieve::KB(s) => { + storage::Retrieve::NVT(_) | storage::Retrieve::NotusAdvisory(_) => Box::new([].into_iter()), + storage::Retrieve::KB(s) => Box::new({ let kbs = self.kbs.lock().map_err(StorageError::from)?; - kbs.iter() - .filter(|x| &x.key == s) + let kbs = kbs.clone(); + kbs.into_iter() + .filter(move |x| x.key == s) .map(|x| storage::Field::KB(x.clone())) - .collect() - } + }), }) } fn retrieve_by_field( &self, - _: &storage::Field, - _: &storage::Retrieve, - ) -> Result)>, StorageError> { - // currently not supported - Ok(vec![]) + _: storage::Field, + _: storage::Retrieve, + ) -> Result>, StorageError> { + Ok(Box::new([].into_iter())) } } diff --git a/rust/models/src/advisories.rs b/rust/models/src/advisories.rs index 20f744404..6c2c2f845 100644 --- a/rust/models/src/advisories.rs +++ b/rust/models/src/advisories.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; /// Represents an advisory json file for notus product. #[cfg_attr(feature = "serde_support", derive(serde::Deserialize))] -#[derive(Debug, Clone)] +#[derive(Debug, Clone,PartialEq, Eq)] pub struct ProductsAdivisories { /// Version of the advisory file pub version: String, @@ -28,6 +28,7 @@ pub struct ProductsAdivisories { feature = "serde_support", derive(serde::Serialize, serde::Deserialize) )] + pub struct Advisories { /// The advisory's title. pub title: String, @@ -156,41 +157,43 @@ impl ProductsAdivisories { } } -pub struct VulnerabilityData<'a> { - pub adv: &'a Advisories, - pub product_data: &'a ProductsAdivisories, - pub filename: &'a String, +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct VulnerabilityData { + pub adv: Advisories, + pub famile: String, + pub filename: String, } -impl<'a> From<&VulnerabilityData<'a>> for Vulnerability { - fn from(data: &VulnerabilityData<'a>) -> Self { - let sv = match &data.adv.severity.cvss_v2 { +impl From for Vulnerability { + fn from(data: VulnerabilityData) -> Self { + let sv = match data.adv.severity.cvss_v2 { Some(cvss) => cvss, - None => match &data.adv.severity.cvss_v3 { + None => match data.adv.severity.cvss_v3 { Some(cvss) => cvss, - None => "", + None => "".to_string(), }, }; + let refs = HashMap::new(); Self { vt_params: Vec::new(), creation_date: data.adv.creation_date, last_modification: data.adv.last_modification, - summary: data.adv.summary.to_owned(), + summary: data.adv.summary, impact: "".to_string(), - affected: data.adv.affected.to_owned(), - insight: data.adv.insight.to_owned(), + affected: data.adv.affected, + insight: data.adv.insight, solution: "Please install the updated package(s).".to_string(), solution_type: "VendorFix".to_string(), vuldetect: "Checks if a vulnerable package version is present on the target host." .to_string(), - qod_type: data.adv.qod_type.to_owned(), - severity_vector: sv.to_string(), - filename: data.filename.to_string(), + qod_type: data.adv.qod_type, + severity_vector: sv, + filename: data.filename, refs, - family: data.product_data.family.to_owned(), - name: data.adv.title.to_owned(), + family: data.famile, + name: data.adv.title, category: "3".to_string(), } } diff --git a/rust/models/src/credential.rs b/rust/models/src/credential.rs index 692aac47c..03a7f06e2 100644 --- a/rust/models/src/credential.rs +++ b/rust/models/src/credential.rs @@ -100,46 +100,35 @@ pub enum CredentialType { /// User/password credentials. UP { /// The username for authentication. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] username: String, /// The password for authentication. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] password: String, }, #[cfg_attr(feature = "serde_support", serde(rename = "usk"))] /// User/ssh-key credentials. USK { /// The username for authentication. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] username: String, /// The password for authentication. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] password: String, #[cfg_attr(feature = "serde_support", serde(rename = "private"))] /// The private key for authentication. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] private_key: String, }, #[cfg_attr(feature = "serde_support", serde(rename = "snmp"))] /// SNMP credentials. SNMP { /// The SNMP username. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] username: String, /// The SNMP password. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] password: String, /// The SNMP community string. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] community: String, /// The SNMP authentication algorithm. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] auth_algorithm: String, /// The SNMP privacy password. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] privacy_password: String, /// The SNMP privacy algorithm. - #[cfg_attr(feature = "serde_support", serde(serialize_with = "crate::censor"))] privacy_algorithm: String, }, } diff --git a/rust/models/src/lib.rs b/rust/models/src/lib.rs index 5473a41f1..ac9c8e6ae 100644 --- a/rust/models/src/lib.rs +++ b/rust/models/src/lib.rs @@ -30,17 +30,8 @@ pub use status::*; pub use target::*; pub use vt::*; -use serde::Serializer; - -fn censor(_: &T, serializer: S) -> std::result::Result -where - S: Serializer, -{ - serializer.serialize_str("***") -} #[cfg(test)] -//#[cfg(feature = "serde_support")] mod tests { use super::scan::Scan; diff --git a/rust/models/src/vt.rs b/rust/models/src/vt.rs index 7000d9f19..93a9617d6 100644 --- a/rust/models/src/vt.rs +++ b/rust/models/src/vt.rs @@ -18,3 +18,4 @@ pub struct VT { /// The list of parameters for the VT pub parameters: Vec, } + diff --git a/rust/nasl-builtin-knowledge-base/src/lib.rs b/rust/nasl-builtin-knowledge-base/src/lib.rs index a6b6395d5..4d7c71fe1 100644 --- a/rust/nasl-builtin-knowledge-base/src/lib.rs +++ b/rust/nasl-builtin-knowledge-base/src/lib.rs @@ -50,11 +50,10 @@ fn get_kb_item(register: &Register, c: &Context) -> Result c .retriever() - .retrieve(c.key(), &Retrieve::KB(x.to_string())) + .retrieve(c.key(), Retrieve::KB(x.to_string())) .map(|r| { r.into_iter().find_map(|x| match x { - Field::NVT(_) => None, - Field::NOTUS(_) => None, + Field::NVT(_) | Field::NotusAdvisory(_) => None, Field::KB(kb) => kb.value.into(), }) }) diff --git a/rust/nasl-cli/src/notusupdate/update.rs b/rust/nasl-cli/src/notusupdate/update.rs index 535a482c5..f24a1a182 100644 --- a/rust/nasl-cli/src/notusupdate/update.rs +++ b/rust/nasl-cli/src/notusupdate/update.rs @@ -5,17 +5,16 @@ use std::path::PathBuf; use crate::{CliError, CliErrorKind}; -use models::{Vulnerability, VulnerabilityData}; + use nasl_syntax::{FSPluginLoader, LoadError}; use notus::loader::{hashsum::HashsumAdvisoryLoader, AdvisoryLoader}; -use redis_storage::NOTUS_KEY; -use storage::{Dispatcher, Field::NOTUS, Notus}; +use storage::Dispatcher; pub fn run(storage: S, path: PathBuf, signature_check: bool) -> Result<(), CliError> where S: Sync + Send + Dispatcher, { - let loader = FSPluginLoader::new(path.to_string_lossy().to_string()); + let loader = FSPluginLoader::new(path); let advisories_files = match HashsumAdvisoryLoader::new(loader.clone()) { Ok(loader) => loader, Err(_) => { @@ -28,7 +27,6 @@ where } }; - // Perform signature check if enabled. if signature_check { match advisories_files.verify_signature() { Ok(_) => tracing::info!("Signature check succsessful"), @@ -61,28 +59,21 @@ where for filename in advisories_files.get_advisories().unwrap().iter() { let advisories = advisories_files.load_advisory(filename).unwrap(); - // Each products contains multiple advisories. Each advisory is converted - // to a Vulnerability, serialized, and stored as a single entry in the cache. - for adv in advisories.iter() { - let key = format!("internal/notus/advisories/{}", adv.oid); - let value = Vulnerability::from(&VulnerabilityData { - adv, - product_data: &advisories, - filename, - }); - - let serialized = serde_json::to_string(&value).unwrap(); - + for adv in advisories.advisories { let _ = storage.dispatch( - &key, - NOTUS(Notus { - value: serialized.into(), - }), + &String::new(), + storage::Field::NotusAdvisory(Box::new(Some(models::VulnerabilityData { + adv, + famile: advisories.family.clone(), + filename: filename.to_owned(), + }))), ); } - // Finally, set the "notuscache" key, so the cache can be found under this key. - let _ = storage.dispatch(&NOTUS_KEY.to_string(), NOTUS(Notus { value: 1.into() })); } + let _ = storage.dispatch( + &"notuscache".to_string(), + storage::Field::NotusAdvisory(Box::new(None)), + ); Ok(()) } diff --git a/rust/nasl-interpreter/tests/description.rs b/rust/nasl-interpreter/tests/description.rs index 0b678c663..941dc0271 100644 --- a/rust/nasl-interpreter/tests/description.rs +++ b/rust/nasl-interpreter/tests/description.rs @@ -92,8 +92,8 @@ if(description) assert_eq!(results, Ok(NaslValue::Exit(23))); assert_eq!( storage - .retrieve(&key, &storage::Retrieve::NVT(None)) - .unwrap(), + .retrieve(&key, storage::Retrieve::NVT(None)) + .unwrap().collect::>(), vec![ NVT(Oid("0.0.0.0.0.0.0.0.0.1".to_owned())), NVT(FileName(key)), diff --git a/rust/nasl-syntax/src/keyword_extension.rs b/rust/nasl-syntax/src/keyword_extension.rs index 218841eb2..f9943f61e 100644 --- a/rust/nasl-syntax/src/keyword_extension.rs +++ b/rust/nasl-syntax/src/keyword_extension.rs @@ -291,7 +291,6 @@ impl<'a> Lexer<'a> { .map_err(Self::map_syntax_error_to_unclosed_left_paren)?, }; if !Self::is_end_of_category(&end, Category::RightParen) { - dbg!(end, update.end().category()); let ut = update.as_token(); return Err(unclosed_token!(Token { category: Category::LeftParen, diff --git a/rust/nasl-syntax/src/lib.rs b/rust/nasl-syntax/src/lib.rs index 2ae87994b..e31fb71ad 100644 --- a/rust/nasl-syntax/src/lib.rs +++ b/rust/nasl-syntax/src/lib.rs @@ -102,7 +102,6 @@ mod tests { let expected = ["a = 23;", "b = 1;"]; for (i, s) in super::parse(code).enumerate() { let stmt = s.unwrap(); - dbg!(stmt.kind()); //assert!(matches!(stmt.kind(), Assign(..))); assert_eq!(&code[stmt.range()], expected[i]); } diff --git a/rust/notus/src/loader/fs.rs b/rust/notus/src/loader/fs.rs index 960755016..0b47bce14 100644 --- a/rust/notus/src/loader/fs.rs +++ b/rust/notus/src/loader/fs.rs @@ -128,7 +128,7 @@ where /// Perform a signature check of the sha256sums file fn verify_signature(&self) -> Result<(), feed::VerifyError> { let p = self.root.as_ref().to_str().unwrap_or_default(); - as self::SignatureChecker>::signature_check(p) + feed::verify::check_signature(p) } /// Get the notus products root directory fn get_root_dir(&self) -> Result { diff --git a/rust/notus/src/loader/hashsum.rs b/rust/notus/src/loader/hashsum.rs index ff3c26ad2..5ffa20858 100644 --- a/rust/notus/src/loader/hashsum.rs +++ b/rust/notus/src/loader/hashsum.rs @@ -104,7 +104,7 @@ where /// Perform a signature check of the sha256sums file fn verify_signature(&self) -> Result<(), feed::VerifyError> { let path = self.loader.root_path().unwrap(); - as self::SignatureChecker>::signature_check(&path) + feed::verify::check_signature(&path) } fn get_root_dir(&self) -> Result { let p = self.loader.root_path().unwrap(); @@ -188,7 +188,7 @@ where /// Perform a signature check of the sha256sums file fn verify_signature(&self) -> Result<(), feed::VerifyError> { let path = self.loader.root_path().unwrap(); - as self::SignatureChecker>::signature_check(&path) + feed::verify::check_signature(&path) } fn get_root_dir(&self) -> Result { let p = self.loader.root_path().unwrap(); diff --git a/rust/openvasd/Cargo.toml b/rust/openvasd/Cargo.toml index a5e60758f..c03adc674 100644 --- a/rust/openvasd/Cargo.toml +++ b/rust/openvasd/Cargo.toml @@ -21,6 +21,7 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } serde_json = "1.0.96" serde = { version = "1.0.163", features = ["derive"] } +bincode = "1" uuid = { version = "1", features = ["v4", "fast-rng", "serde"] } rustls = {version = "0.22"} tokio-rustls = "0.25" @@ -40,5 +41,4 @@ http-body-util = "0.1.0" http-body = "1" [dev-dependencies] -bincode = "1" tracing-test = "0.1" diff --git a/rust/openvasd/src/config.rs b/rust/openvasd/src/config.rs index f38d3dc68..ffba83154 100644 --- a/rust/openvasd/src/config.rs +++ b/rust/openvasd/src/config.rs @@ -22,11 +22,12 @@ pub struct Feed { #[derive(Deserialize, Serialize, Debug, Clone)] pub struct Notus { pub products_path: PathBuf, + pub advisories_path: PathBuf, } #[derive(Deserialize, Serialize, Debug, Clone)] -pub struct RedisSocket { - pub redis_socket: PathBuf, +pub struct Redis { + pub url: String, } #[derive(Deserialize, Serialize, Debug, Clone)] @@ -60,14 +61,15 @@ impl Default for Notus { fn default() -> Self { Notus { products_path: PathBuf::from("/var/lib/notus/products"), + advisories_path: PathBuf::from("/var/lib/notus/advisories"), } } } -impl Default for RedisSocket { +impl Default for Redis { fn default() -> Self { - RedisSocket { - redis_socket: PathBuf::from("unix:///run/redis-openvas/redis.sock"), + Redis { + url: "unix:///run/redis-openvas/redis.sock".to_string(), } } } @@ -120,6 +122,8 @@ pub enum StorageType { InMemory, #[serde(rename = "fs")] FileSystem, + #[serde(rename = "redis")] + Redis, } impl TypedValueParser for StorageType { @@ -167,6 +171,8 @@ pub struct Storage { pub storage_type: StorageType, #[serde(default)] pub fs: FileStorage, + #[serde(default)] + pub redis: Redis, } #[derive(Deserialize, Serialize, Debug, Clone, Default)] @@ -187,8 +193,6 @@ pub struct Config { pub log: Logging, #[serde(default)] pub storage: Storage, - #[serde(default)] - pub redis_socket: RedisSocket, } impl Display for Config { @@ -256,19 +260,26 @@ impl Config { .value_name("SECONDS") .help("interval to check for feed updates in seconds"), ) + .arg( + clap::Arg::new("notus-advisories") + .env("NOTUS_SCANNER_PRODUCTS_DIRECTORY") + .long("advisories") + .value_parser(clap::builder::PathBufValueParser::new()) + .action(ArgAction::Set) + .help("Path containing the Notus advisories directory")) .arg( clap::Arg::new("notus-products") .env("NOTUS_SCANNER_PRODUCTS_DIRECTORY") - .long("products-directory") + .long("products") .value_parser(clap::builder::PathBufValueParser::new()) .action(ArgAction::Set) .help("Path containing the Notus products directory")) .arg( - clap::Arg::new("redis-socket ") - .long("redis-socket") - .value_parser(clap::builder::PathBufValueParser::new()) + clap::Arg::new("redis-url") + .long("redis-url") + //.value_parser(clap::builder::PathBufValueParser::new()) .action(ArgAction::Set) - .help("Path to the redis socket")) + .help("Redis url. Either unix:// or redis://")) .arg( clap::Arg::new("tls-certs") .env("TLS_CERTS") @@ -399,8 +410,11 @@ impl Config { if let Some(path) = cmds.get_one::("notus-products") { config.notus.products_path = path.clone(); } - if let Some(path) = cmds.get_one::("redis-socket") { - config.redis_socket.redis_socket = path.clone(); + if let Some(path) = cmds.get_one::("notus-advisories") { + config.notus.advisories_path = path.clone(); + } + if let Some(path) = cmds.get_one::("redis-socket") { + config.storage.redis.url = path.clone(); } if let Some(path) = cmds.get_one::("tls-certs") { config.tls.certs = Some(path.clone()); diff --git a/rust/openvasd/src/controller/context.rs b/rust/openvasd/src/controller/context.rs index a8ccf766e..bf9a46f90 100644 --- a/rust/openvasd/src/controller/context.rs +++ b/rust/openvasd/src/controller/context.rs @@ -5,12 +5,10 @@ use std::{path::PathBuf, sync::RwLock}; use async_trait::async_trait; -use redis_storage::RedisCtx; use storage::DefaultDispatcher; use crate::{ notus::NotusWrapper, - ospcmd::{self, GetVtsWrapper}, response, scan::{Error, ScanDeleter, ScanResultFetcher, ScanStarter, ScanStopper}, }; @@ -71,7 +69,6 @@ pub struct ContextBuilder { marker: std::marker::PhantomData, response: response::Response, notus: Option, - redis_cache: Option>, } impl @@ -89,7 +86,6 @@ impl enable_get_scans: false, response: response::Response::default(), notus: None, - redis_cache: None, } } } @@ -135,12 +131,6 @@ impl ContextBuilder { self } - /// Set redis cache - pub fn redis_cache(mut self, redis_cache: GetVtsWrapper) -> Self { - self.redis_cache = Some(redis_cache); - self - } - /// Sets the storage. #[allow(dead_code)] pub fn storage(self, storage: NDB) -> ContextBuilder { @@ -154,7 +144,6 @@ impl ContextBuilder { marker, response, notus, - redis_cache, } = self; ContextBuilder { scanner, @@ -166,7 +155,6 @@ impl ContextBuilder { marker, response, notus, - redis_cache, } } } @@ -190,7 +178,6 @@ where response, storage, notus, - redis_cache, } = self; ContextBuilder { scanner: Scanner(scanner), @@ -202,7 +189,6 @@ where enable_get_scans, response, notus, - redis_cache, } } } @@ -219,7 +205,6 @@ impl ContextBuilder> { api_key: self.api_key, enable_get_scans: self.enable_get_scans, notus: self.notus, - redis_cache: self.redis_cache, } } } @@ -250,8 +235,6 @@ pub struct Context { pub abort: RwLock, /// Notus Scanner pub notus: Option, - /// Redis cache - pub redis_cache: Option>, } #[derive(Debug, Clone, Default)] diff --git a/rust/openvasd/src/controller/entry.rs b/rust/openvasd/src/controller/entry.rs index b716b70f5..20b74191a 100644 --- a/rust/openvasd/src/controller/entry.rs +++ b/rust/openvasd/src/controller/entry.rs @@ -6,14 +6,12 @@ //! //! All known paths must be handled in the entrypoint function. -use std::{fmt::Display, sync::Arc, marker::PhantomData}; +use std::{fmt::Display, marker::PhantomData, sync::Arc}; use super::{context::Context, ClientIdentifier}; use hyper::{Method, Request}; -use crate::ospcmd::getvts::GetVts; - use crate::{ controller::ClientHash, notus::NotusScanner, @@ -37,20 +35,18 @@ enum KnownPaths { /// /scans/{id}/status ScanStatus(String), /// /vts - Vts, + Vts(Option), /// /health Health(HealthOpts), /// /notus/{os} Notus(Option), - /// /get_vts/ - GetVts(Option), /// Not supported Unknown, } impl KnownPaths { pub fn requires_id(&self) -> bool { - !matches!(self, Self::Health(_) | Self::Vts | Self::Notus(_)) + !matches!(self, Self::Health(_) | Self::Vts(_) | Self::Notus(_)) } #[tracing::instrument] @@ -69,7 +65,10 @@ impl KnownPaths { }, None => KnownPaths::Scans(None), }, - Some("vts") => KnownPaths::Vts, + Some("vts") => match parts.next() { + Some(oid) => KnownPaths::Vts(Some(oid.to_string())), + None => KnownPaths::Vts(None), + }, Some("notus") => match parts.next() { Some(os) => KnownPaths::Notus(Some(os.to_string())), None => KnownPaths::Notus(None), @@ -80,10 +79,6 @@ impl KnownPaths { Some("started") => KnownPaths::Health(HealthOpts::Started), _ => KnownPaths::Unknown, }, - Some("get_vts") => match parts.next() { - Some(vt_selection) => KnownPaths::GetVts(Some(vt_selection.to_string())), - _ => KnownPaths::GetVts(None), - }, _ => { tracing::trace!("Unknown path: {path}"); KnownPaths::Unknown @@ -110,14 +105,13 @@ impl Display for KnownPaths { KnownPaths::ScanResults(id, None) => write!(f, "/scans/{}/results", id), KnownPaths::ScanStatus(id) => write!(f, "/scans/{}/status", id), KnownPaths::Unknown => write!(f, "Unknown"), - KnownPaths::Vts => write!(f, "/vts"), + KnownPaths::Vts(None) => write!(f, "/vts"), + KnownPaths::Vts(Some(oid)) => write!(f, "/vts/{oid}"), KnownPaths::Notus(Some(os)) => write!(f, "/notus/{}", os), KnownPaths::Notus(None) => write!(f, "/notus"), KnownPaths::Health(HealthOpts::Alive) => write!(f, "/health/alive"), KnownPaths::Health(HealthOpts::Ready) => write!(f, "/health/ready"), KnownPaths::Health(HealthOpts::Started) => write!(f, "/health/started"), - KnownPaths::GetVts(None) => write!(f, "/get_vts"), - KnownPaths::GetVts(Some(vt_selection)) => write!(f, "/get_vts/{}", vt_selection), } } } @@ -126,7 +120,6 @@ pub struct EntryPoint { pub ctx: Arc>, pub cid: Arc, _phantom: PhantomData, - } impl EntryPoint { @@ -136,12 +129,9 @@ impl EntryPoint { cid, _phantom: PhantomData, } - } - } - impl hyper::service::Service> for EntryPoint where S: ScanStarter @@ -264,7 +254,8 @@ where } } (&Method::POST, Scans(None)) => { - match crate::request::json_request::(&ctx.response, req).await { + match crate::request::json_request::(&ctx.response, req).await + { Ok(mut scan) => { if scan.scan_id.is_some() { return Ok(ctx @@ -335,7 +326,19 @@ where } } (&Method::GET, Scans(Some(id))) => match ctx.db.get_scan(&id).await { - Ok((scan, _)) => Ok(ctx.response.ok(&scan)), + Ok((mut scan, _)) => { + let credentials = scan + .target + .credentials + .into_iter() + .map(move |c| { + let c = c.map_password::<_, Error>(|_| Ok("***".to_string())); + c.unwrap() + }) + .collect::>(); + scan.target.credentials = credentials; + Ok(ctx.response.ok(&scan)) + } Err(crate::storage::Error::NotFound) => { Ok(ctx.response.not_found("scans", &id)) } @@ -389,9 +392,7 @@ where }; match ctx.db.get_results(&id, begin, end).await { - Ok(results) => { - Ok(ctx.response.ok_byte_stream(results).await) - }, + Ok(results) => Ok(ctx.response.ok_byte_stream(results).await), Err(crate::storage::Error::NotFound) => { Ok(ctx.response.not_found("scans/results", &id)) } @@ -399,27 +400,21 @@ where } } - (&Method::GET, Vts) => { - let oids = ctx.db.oids().await?; - - Ok(ctx.response.ok_json_stream(oids).await) - } - (&Method::GET, GetVts(None)) => match &ctx.redis_cache { - Some(cache) => match cache.get_vts(None).await { - Ok(nvts) => Ok(ctx.response.ok(&nvts)), - Err(err) => Ok(ctx.response.internal_server_error(&err)), - }, - None => Ok(ctx.response.empty(hyper::StatusCode::OK)), - }, - (&Method::GET, GetVts(Some(vt_selection))) => { - let selection: Vec = vt_selection.split(',').map(|x| x.to_string()).collect(); + (&Method::GET, Vts(oid)) => { + let query = req.uri().query(); - match &ctx.redis_cache { - Some(cache) => match cache.get_vts(Some(selection)).await { - Ok(nvts) => Ok(ctx.response.ok(&nvts)), - Err(err) => Ok(ctx.response.internal_server_error(&err)), + let meta = match query { + Some("information=true") => true, + Some("information=1") => true, + Some(_) | None => false, + }; + match oid { + Some(oid) => match ctx.db.vt_by_oid(&oid).await? { + Some(nvt) => Ok(ctx.response.ok(&nvt)), + None => Ok(ctx.response.not_found("nvt", &oid)), }, - None => Ok(ctx.response.empty(hyper::StatusCode::OK)), + None if meta => Ok(ctx.response.ok_json_stream(ctx.db.vts().await?).await), + None => Ok(ctx.response.ok_json_stream(ctx.db.oids().await?).await), } } _ => Ok(ctx.response.not_found("path", req.uri().path())), @@ -427,4 +422,3 @@ where }) } } - diff --git a/rust/openvasd/src/controller/feed.rs b/rust/openvasd/src/controller/feed.rs index 81de406de..870620d40 100644 --- a/rust/openvasd/src/controller/feed.rs +++ b/rust/openvasd/src/controller/feed.rs @@ -24,38 +24,31 @@ where break; }; let last_hash = ctx.db.feed_hash().await; - let result = tokio::task::spawn_blocking(move || { - let hash = match FeedIdentifier::sumfile_hash(&path) { + if signature_check { + if let Err(err) = feed::verify::check_signature(&path) { + tracing::warn!("Signature of {} is not corredct, skipping: {}", path.display(), err); + + } + } + + let hash = tokio::task::spawn_blocking(move || { + match FeedIdentifier::sumfile_hash(path) { Ok(h) => h, Err(e) => { tracing::warn!("Failed to compute sumfile hash: {e:?}"); "".to_string() } - }; - - if last_hash.is_empty() || last_hash.clone() != hash { - FeedIdentifier::from_feed(&path, signature_check).map(|x| (hash, x)) - } else { - Ok((String::new(), vec![])) } }) .await .unwrap(); - match result { - Ok((hash, oids)) => { - if !oids.is_empty() { - match ctx.db.push_oids(hash.clone(), oids).await { - Ok(_) => { - tracing::debug!("updated feed {hash}") - } - Err(e) => { - tracing::warn!("unable to fetch new oids, leaving the old: {e:?}") - } - } - } + if last_hash.is_empty() || last_hash != hash { + match ctx.db.synchronize_feeds(hash).await{ + Ok(_) => {}, + Err(e) => tracing::warn!("Unable to sync feed: {e}"), } - Err(e) => tracing::warn!("unable to fetch new oids, leaving the old: {e:?}"), - }; + + } tokio::time::sleep(interval).await; } } diff --git a/rust/openvasd/src/controller/mod.rs b/rust/openvasd/src/controller/mod.rs index 9632c23d4..87992cf22 100644 --- a/rust/openvasd/src/controller/mod.rs +++ b/rust/openvasd/src/controller/mod.rs @@ -431,7 +431,9 @@ mod tests { }; let ns = std::time::Duration::from_nanos(10); let root = "/tmp/openvasd/fetch_results"; - let storage = file::unencrypted(root).unwrap(); + let nfp = "../../examples/feed/nasl"; + let nofp = "../../examples/feed/notus/advisories"; + let storage = file::unencrypted(root, nfp, nofp).unwrap(); let ctx = ContextBuilder::new() .result_config(ns) .storage(storage) @@ -457,10 +459,8 @@ mod tests { } } - dbg!("befote fetching results"); let mut resp = get_results(&id, Arc::clone(&controller), None, None).await; - dbg!("after resp?"); resp.sort_by(|a, b| a.id.cmp(&b.id)); assert_eq!(resp.len(), 4950); resp.iter().enumerate().for_each(|(i, r)| { diff --git a/rust/openvasd/src/main.rs b/rust/openvasd/src/main.rs index 86aee3077..01190a5ea 100644 --- a/rust/openvasd/src/main.rs +++ b/rust/openvasd/src/main.rs @@ -5,24 +5,17 @@ use ::notus::{loader::hashsum::HashsumProductLoader, notus::Notus}; use nasl_interpreter::FSPluginLoader; use notus::NotusWrapper; -use redis_storage::{ - CacheDispatcher, RedisCtx, VtHelper, FEEDUPDATE_SELECTOR, NOTUSUPDATE_SELECTOR, -}; - - pub mod config; pub mod controller; pub mod crypt; pub mod feed; pub mod notus; -pub mod ospcmd; pub mod request; pub mod response; pub mod scan; pub mod storage; pub mod tls; - fn create_context( db: DB, config: &config::Config, @@ -45,27 +38,6 @@ fn create_context( Err(e) => tracing::warn!("Notus Scanner disabled: {e}"), } - if let Some(redis) = config.redis_socket.redis_socket.to_str() { - let notus_cache: CacheDispatcher; - match CacheDispatcher::init(redis, NOTUSUPDATE_SELECTOR) { - Ok(c) => {notus_cache = c;}, - Err(e) =>{ - notus_cache = CacheDispatcher::default(); - tracing::warn!("No notus cache found: {e}"); - }, - }; - let vts_cache: CacheDispatcher; - match CacheDispatcher::init(redis, FEEDUPDATE_SELECTOR) { - Ok(c) => {vts_cache = c;}, - Err(e) =>{ - vts_cache = CacheDispatcher::default(); - tracing::warn!("No vts cache found: {e}"); - }, - }; - let cache = VtHelper::new(notus_cache, vts_cache); - ctx_builder = ctx_builder.redis_cache(ospcmd::GetVtsWrapper::new(cache)); - } - ctx_builder .result_config(rc) .feed_config(fc) @@ -76,7 +48,6 @@ fn create_context( .build() } - #[tokio::main] async fn main() -> Result<(), Box> { let config = config::Config::load(); @@ -89,10 +60,37 @@ async fn main() -> Result<(), Box> { tracing::warn!("OSPD socket {} does not exist. Some commands will not work until the socket is created!", config.ospd.socket.display()); } match config.storage.storage_type { + config::StorageType::Redis => { + tracing::info!("using in redis {}", config.storage.redis.url); + + let ic = storage::inmemory::Storage::new( + crate::crypt::ChaCha20Crypt::default(), + &config.feed.path, + &config.notus.advisories_path, + ); + let ctx = create_context( + storage::redis::Storage::new( + ic, + config.storage.redis.url.clone(), + &config.feed.path, + &config.notus.advisories_path, + ), + &config, + ); + controller::run(ctx, &config).await + } config::StorageType::InMemory => { tracing::info!("using in memory store. No sensitive data will be stored on disk."); - let ctx = create_context(storage::inmemory::Storage::default(), &config); + // Self::new(crate::crypt::ChaCha20Crypt::default(), "/var/lib/openvas/feed".to_string()) + let ctx = create_context( + storage::inmemory::Storage::new( + crate::crypt::ChaCha20Crypt::default(), + &config.feed.path, + &config.notus.advisories_path, + ), + &config, + ); controller::run(ctx, &config).await } config::StorageType::FileSystem => { @@ -102,7 +100,12 @@ async fn main() -> Result<(), Box> { ); let ctx = create_context( - storage::file::encrypted(&config.storage.fs.path, key)?, + storage::file::encrypted( + &config.storage.fs.path, + key, + &config.feed.path, + &config.notus.advisories_path, + )?, &config, ); controller::run(ctx, &config).await @@ -111,7 +114,11 @@ async fn main() -> Result<(), Box> { "using in file storage. Sensitive data will be stored on disk without any encryption." ); let ctx = create_context( - storage::file::unencrypted(&config.storage.fs.path)?, + storage::file::unencrypted( + &config.storage.fs.path, + &config.feed.path, + &config.notus.advisories_path, + )?, &config, ); controller::run(ctx, &config).await diff --git a/rust/openvasd/src/ospcmd/getvts.rs b/rust/openvasd/src/ospcmd/getvts.rs deleted file mode 100644 index bc352c561..000000000 --- a/rust/openvasd/src/ospcmd/getvts.rs +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Greenbone AG -// -// SPDX-License-Identifier: GPL-2.0-or-later - -use std::marker::PhantomData; - -use async_trait::async_trait; - -use redis_storage::{RedisAddAdvisory, RedisAddNvt, RedisGetNvt, RedisWrapper, VtHelper}; -use storage::{StorageError, item::Nvt}; -use tokio::sync::RwLock; - -#[async_trait] -pub trait GetVts { - async fn get_oids(&self) -> Result, StorageError>; - - async fn get_vts(&self, vt_selection: Option>) - -> Result, StorageError>; -} - -#[derive(Debug, Default)] -pub struct GetVtsWrapper -where - R: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt + Sync + Send, - K: AsRef + Sync + Send, -{ - vthelper: RwLock>, - phantom: PhantomData, -} - -impl GetVtsWrapper -where - R: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt + Sync + Send, - K: AsRef + Sync + Send, -{ - pub fn new(vthelper: VtHelper) -> Self { - Self { - vthelper: RwLock::new(vthelper), - phantom: PhantomData, - } - } -} - - -#[async_trait] -impl GetVts for GetVtsWrapper -where - R: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt + Sync + Send, - K: AsRef + Sync + Send + 'static, -{ - async fn get_oids(&self) -> Result, StorageError> { - self.vthelper.read().await.get_oids() - } - - async fn get_vts( - &self, - vt_selection: Option>, - ) -> Result, StorageError> { - - let oids: Vec; - if let Some(selection) = vt_selection { - oids = selection; - } else { - oids = self.get_oids().await?; - } - - let mut nvts = Vec::new(); - for oid in oids { - nvts.push( - match self.vthelper.read().await.retrieve_single_nvt(&oid)? { - Some(vt) => vt, - None => continue, - } - ); - } - Ok(nvts) - } -} diff --git a/rust/openvasd/src/ospcmd/mod.rs b/rust/openvasd/src/ospcmd/mod.rs deleted file mode 100644 index 98d14b710..000000000 --- a/rust/openvasd/src/ospcmd/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Greenbone AG -// -// SPDX-License-Identifier: GPL-2.0-or-later - -pub mod getvts; -pub use getvts::GetVtsWrapper; diff --git a/rust/openvasd/src/storage/file.rs b/rust/openvasd/src/storage/file.rs index 04b65a02a..04903e455 100644 --- a/rust/openvasd/src/storage/file.rs +++ b/rust/openvasd/src/storage/file.rs @@ -1,24 +1,38 @@ -use std::{ops::Deref, path::Path}; +use std::{ + ops::Deref, + path::{Path, PathBuf}, +}; + +use nasl_interpreter::FSPluginLoader; +use notus::loader::{hashsum::HashsumAdvisoryLoader, AdvisoryLoader}; +use storage::item::{ItemDispatcher, Nvt, PerItemDispatcher}; use super::*; pub struct Storage { - storage: Arc>, - // although that will be lost on restart I will be read into immediately on start by parsing - // the feed. hash: tokio::sync::RwLock, + nasl_feed_path: Arc, + notus_feed_path: Arc, + storage: Arc>, + feed_version: Arc>, } -pub fn unencrypted

(path: P) -> Result, Error> +pub fn unencrypted

( + path: P, + nasl_feed_path: P, + notus_feed_path: P, +) -> Result, Error> where P: AsRef, { let ifs = infisto::base::IndexedFileStorer::init(path)?; - Ok(ifs.into()) + Ok(Storage::new(ifs, nasl_feed_path, notus_feed_path)) } pub fn encrypted( path: P, key: K, + nasl_feed_path: P, + notus_feed_path: P, ) -> Result< Storage>, Error, @@ -28,7 +42,8 @@ where K: Into, { let ifs = infisto::base::IndexedFileStorer::init(path)?; - Ok(infisto::crypto::ChaCha20IndexFileStorer::new(ifs, key).into()) + let ifs = infisto::crypto::ChaCha20IndexFileStorer::new(ifs, key); + Ok(Storage::new(ifs, nasl_feed_path, notus_feed_path)) } impl From for Error { @@ -37,20 +52,18 @@ impl From for Error { } } -impl From for Storage -where - S: infisto::base::IndexedByteStorage + std::marker::Sync + std::marker::Send + 'static, -{ - fn from(value: S) -> Self { - Storage::new(value) - } -} - impl Storage { - pub fn new(s: S) -> Self { + pub fn new

(s: S, nasl_feed_path: P, notus_feed_path: P) -> Self + where + P: AsRef, + { Storage { storage: Arc::new(s.into()), hash: tokio::sync::RwLock::new(String::new()), + nasl_feed_path: Arc::new(nasl_feed_path.as_ref().to_path_buf()), + notus_feed_path: Arc::new(notus_feed_path.as_ref().to_path_buf()), + + feed_version: Arc::new(std::sync::RwLock::new(String::new())), } } } @@ -95,7 +108,7 @@ where let storage = Arc::clone(&self.storage); use infisto::base::Range; - use infisto::bincode::Serialization; + use infisto::serde::Serialization; tokio::task::spawn_blocking(move || { let storage = storage.read().unwrap(); let scans: Vec> = storage.by_range(&key, Range::All)?; @@ -118,7 +131,7 @@ where async fn get_scan_ids(&self) -> Result, Error> { let storage = Arc::clone(&self.storage); use infisto::base::Range; - use infisto::bincode::Serialization; + use infisto::serde::Serialization; tokio::task::spawn_blocking(move || { let storage = &storage.read().unwrap(); let scans: Vec> = match storage.by_range("scans", Range::All) { @@ -145,7 +158,7 @@ where let storage = Arc::clone(&self.storage); use infisto::base::Range; - use infisto::bincode::Serialization; + use infisto::serde::Serialization; tokio::task::spawn_blocking(move || { let storage = &storage.read().unwrap(); let status: Vec> = storage.by_range(&key, Range::All)?; @@ -204,13 +217,13 @@ where let status_key = format!("status_{id}"); let storage = Arc::clone(&self.storage); tokio::task::spawn_blocking(move || { - let scan = infisto::bincode::Serialization::serialize(scan)?; - let status = infisto::bincode::Serialization::serialize(models::Status::default())?; + let scan = infisto::serde::Serialization::serialize(scan)?; + let status = infisto::serde::Serialization::serialize(models::Status::default())?; let mut storage = storage.write().unwrap(); storage.put(&key, scan)?; storage.put(&status_key, status)?; - let stored_key = infisto::bincode::Serialization::serialize(&id)?; + let stored_key = infisto::serde::Serialization::serialize(&id)?; storage.append("scans", stored_key)?; Ok(()) }) @@ -226,7 +239,7 @@ where let ids: Vec<_> = ids .into_iter() .filter(|x| x != id) - .filter_map(|x| infisto::bincode::Serialization::serialize(x).ok()) + .filter_map(|x| infisto::serde::Serialization::serialize(x).ok()) .collect(); tokio::task::spawn_blocking(move || { @@ -247,7 +260,7 @@ where let storage = Arc::clone(&self.storage); tokio::task::spawn_blocking(move || { - let status = infisto::bincode::Serialization::serialize(status)?; + let status = infisto::serde::Serialization::serialize(status)?; let mut storage = storage.write().unwrap(); storage.put(&key, status)?; Ok(()) @@ -298,7 +311,7 @@ where .map(|x| x.deserialize()) .filter_map(|x| x.ok()) .filter(|(_, x)| x != sid) - .map(infisto::serde::Serialization::serialize) + .map(Serialization::serialize) .filter_map(|x| x.ok()) .collect(); @@ -337,47 +350,156 @@ where .unwrap() } } + +struct Dispa { + storage: Arc>>, + feed_version: Arc>, +} + +impl ItemDispatcher for Dispa { + fn dispatch_nvt(&self, nvt: Nvt) -> Result<(), storage::StorageError> { + let mut storage = self.storage.write().unwrap(); + let oid = nvt.oid.clone(); + storage.insert(oid, nvt); + Ok(()) + } + + fn dispatch_feed_version(&self, version: String) -> Result<(), storage::StorageError> { + let mut feed_version = self.feed_version.write().unwrap(); + *feed_version = version; + Ok(()) + } + + fn dispatch_advisory( + &self, + _: &str, + _: Box>, + ) -> Result<(), storage::StorageError> { + Ok(()) + } +} + +pub const FEED_KEY: &str = "nvts"; + #[async_trait] -impl OIDStorer for Storage +impl NVTStorer for Storage where S: infisto::base::IndexedByteStorage + std::marker::Sync + std::marker::Send + Clone + 'static, { - async fn push_oids(&self, hash: String, oids: Vec) -> Result<(), Error> { - let key = "oids".to_string(); - let storage = Arc::clone(&self.storage); + async fn synchronize_feeds(&self, hash: String) -> Result<(), Error> { let mut h = self.hash.write().await; *h = hash; + drop(h); + tracing::debug!("starting feed update in file {}", &FEED_KEY); + let storage = Arc::clone(&self.storage); + // we cache them upfront to avoid deletion and faster storage + let nvts = Arc::new(std::sync::RwLock::new(HashMap::with_capacity(100000))); + let notus_feed_path = self.notus_feed_path.clone(); + let feed_version = self.feed_version.clone(); + let nasl_feed_path = self.nasl_feed_path.clone(); + + let tnvts = nvts.clone(); + let notus_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting notus feed update"); + let loader = FSPluginLoader::new(notus_feed_path.as_ref()); + let advisories_files = HashsumAdvisoryLoader::new(loader.clone())?; + + for filename in advisories_files.get_advisories()?.iter() { + let advisories = advisories_files.load_advisory(filename)?; + + for adv in advisories.advisories { + let data = models::VulnerabilityData { + adv, + famile: advisories.family.clone(), + filename: filename.to_owned(), + }; + let nvt: Nvt = data.into(); + let mut storage = tnvts.write().unwrap(); + storage.insert(nvt.oid.clone(), nvt); + + drop(storage); + } + } + tracing::debug!("finished notus feed update"); + Ok::<_, Error>(()) + }); + let tnvts = nvts.clone(); + + let active_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting nasl feed update"); + let oversion = "0.1"; + let loader = FSPluginLoader::new(nasl_feed_path.as_ref()); + let verifier = feed::HashSumNameLoader::sha256(&loader)?; + + let store = PerItemDispatcher::new(Dispa { + storage: tnvts, + feed_version, + }); + let mut fu = feed::Update::init(oversion, 5, loader.clone(), store, verifier); + if let Some(x) = fu.find_map(|x| x.err()) { + tracing::debug!("{}", x); + Err(Error::from(x)) + } else { + tracing::debug!("finished nasl feed update"); + Ok(()) + } + }); + + let nasl_result = active_feed.await.unwrap(); + let notus_result: Result<(), Error> = notus_feed.await.unwrap(); + let tnvts = nvts.clone(); tokio::task::spawn_blocking(move || { - let oids = oids - .into_iter() - .filter_map(|x| infisto::bincode::Serialization::serialize(x.to_string()).ok()) + let mut storage = storage.write().expect("storage seems to be poisoned"); + let _ = storage.remove(FEED_KEY); + let tnvts = tnvts.read().unwrap(); + let srs = tnvts + .values() + .filter_map(|x| infisto::serde::Serialization::serialize(x).ok()) .collect::>(); - let mut storage = storage.write().unwrap(); - match storage.remove(&key) { - Ok(_) => {} - Err(infisto::base::Error::Remove(std::io::ErrorKind::NotFound)) => {} - Err(e) => return Err(e.into()), - }; - storage.append_all(&key, &oids)?; - Ok(()) + tracing::debug!("writing stuff {}", srs.len()); + storage.append_all(FEED_KEY, &srs)?; + tracing::debug!("ahah"); + Ok::<_, Error>(()) }) .await - .unwrap() + .unwrap()?; + tracing::debug!("finished feed update"); + + match (nasl_result, notus_result) { + (Ok(_), Ok(_)) => Ok(()), + (Ok(_), Err(err)) => Err(err), + (Err(err), Ok(_)) => Err(err), + (Err(err), Err(_)) => Err(err), + } } async fn oids(&self) -> Result + Send>, Error> { - let key = "oids".to_string(); let storage = &self.storage.read().unwrap(); let storage: S = storage.deref().clone(); let iter = infisto::base::IndexedByteStorageIterator::< _, - infisto::bincode::Serialization, - >::new(&key, storage)?; + infisto::serde::Serialization, + >::new(FEED_KEY, storage)?; let parsed = iter .filter_map(|x| x.ok()) - .filter_map(|x| x.deserialize().ok()); + .filter_map(|x| x.deserialize().ok()) + .map(|x| x.oid); + + Ok(Box::new(parsed)) + } + + async fn vts<'a>( + &self, + ) -> Result + Send + 'a>, Error> { + let storage = &self.storage.read().unwrap(); + let storage: S = storage.deref().clone(); + let iter = infisto::base::IndexedByteStorageIterator::< + _, + infisto::serde::Serialization, + >::new(FEED_KEY, storage)?; + let parsed = iter.map(|x| x.unwrap()).map(|x| x.deserialize().unwrap()); Ok(Box::new(parsed)) } @@ -443,7 +565,9 @@ mod tests { scan.scan_id = Some("aha".to_string()); let storage = infisto::base::CachedIndexFileStorer::init("/tmp/openvasd/credential").unwrap(); - let storage = crate::storage::file::Storage::new(storage); + let nfp = "../../examples/feed/nasl"; + let nofp = "../../examples/feed/notus/advisories"; + let storage = crate::storage::file::Storage::new(storage, nfp, nofp); storage.insert_scan(scan.clone()).await.unwrap(); let (scan2, _) = storage.get_scan("aha").await.unwrap(); assert_eq!(scan, scan2); @@ -451,23 +575,39 @@ mod tests { #[tokio::test] async fn oids() { - let mut oids = Vec::with_capacity(100000); - for i in 0..(oids.capacity()) { - oids.push(i.to_string()); - } let storage = infisto::base::CachedIndexFileStorer::init("/tmp/openvasd/oids").unwrap(); - let storage = crate::storage::file::Storage::new(storage); - storage - .push_oids(String::new(), oids.clone()) + + let base = std::env::current_dir().unwrap_or_default(); + + let mut tbase = base.parent().unwrap().join("examples"); + if std::fs::metadata(&tbase).is_err() { + tbase = base.join("examples"); + } + let base_dir = tbase.join("feed"); + + let nfp = base_dir.join("nasl"); + let nofp = base_dir.join("notus").join("advisories"); + let file_storage = crate::storage::file::Storage::new(storage, &nfp, &nofp); + file_storage + .synchronize_feeds("123".to_string()) .await .unwrap(); - let noids = storage.oids().await.unwrap(); - let mut len = 0; - for (i, s) in noids.enumerate() { - assert_eq!(s, oids[i]); - len += 1; - } - assert_eq!(len, oids.len()); + let amount_file_oids = file_storage.oids().await.unwrap().count(); + + let mut storage = infisto::base::CachedIndexFileStorer::init("/tmp/openvasd/oids").unwrap(); + storage.remove(crate::storage::file::FEED_KEY).unwrap(); + let memory_storage = crate::storage::inmemory::Storage::new( + crate::crypt::ChaCha20Crypt::default(), + nfp, + nofp, + ); + memory_storage + .synchronize_feeds("123".to_string()) + .await + .unwrap(); + let amount_memory_oids = memory_storage.oids().await.unwrap().count(); + assert_eq!(amount_memory_oids, 101); + assert_eq!(amount_memory_oids, amount_file_oids); } #[tokio::test] @@ -483,7 +623,9 @@ mod tests { let storage = infisto::base::CachedIndexFileStorer::init("/tmp/openvasd/file_storage_test").unwrap(); - let storage = crate::storage::file::Storage::new(storage); + let nfp = "../../examples/feed/nasl"; + let nofp = "../../examples/feed/notus/advisories"; + let storage = crate::storage::file::Storage::new(storage, nfp, nofp); for s in scans.clone().into_iter() { storage.insert_scan(s).await.unwrap() } @@ -536,7 +678,9 @@ mod tests { infisto::base::CachedIndexFileStorer::init("/tmp/openvasd/file_storage_id_mapper_test") .unwrap(); - let storage = crate::storage::file::Storage::new(storage); + let nfp = "../../examples/feed/nasl"; + let nofp = "../../examples/feed/notus/advisories"; + let storage = crate::storage::file::Storage::new(storage, nfp, nofp); storage .add_scan_client_id("s1".to_owned(), "0".into()) .await diff --git a/rust/openvasd/src/storage/inmemory.rs b/rust/openvasd/src/storage/inmemory.rs index 714355f51..cfa5b3798 100644 --- a/rust/openvasd/src/storage/inmemory.rs +++ b/rust/openvasd/src/storage/inmemory.rs @@ -1,4 +1,12 @@ +use std::{ + collections::HashSet, + path::{Path, PathBuf}, +}; + use super::*; +use nasl_interpreter::FSPluginLoader; +use notus::loader::{hashsum::HashsumAdvisoryLoader, AdvisoryLoader}; +use storage::item::{ItemDispatcher, Nvt, PerItemDispatcher}; use tokio::sync::RwLock; #[derive(Clone, Debug, Default)] @@ -16,24 +24,81 @@ struct Progress { #[derive(Debug)] pub struct Storage { scans: RwLock>, - oids: RwLock>, + nvts: Arc>>, + feed_version: Arc>, hash: RwLock, client_id: RwLock>, - + nasl_feed_path: Arc, + notus_feed_path: Arc, crypter: E, } +struct Dispa { + nvts: Arc>>, + feed_version: Arc>, +} + +impl ItemDispatcher for Dispa { + fn dispatch_nvt(&self, nvt: Nvt) -> Result<(), storage::StorageError> { + let rt = tokio::runtime::Builder::new_current_thread() + .build() + .expect("Expected to be able to build a thread"); + rt.block_on(async { + let mut nvts = self.nvts.write().await; + nvts.insert(nvt); + }); + Ok(()) + } + + fn dispatch_feed_version(&self, version: String) -> Result<(), storage::StorageError> { + let rt = tokio::runtime::Builder::new_current_thread() + .build() + .expect("Expected to be able to build a thread"); + rt.block_on(async { + let mut feed_version = self.feed_version.write().await; + *feed_version = version; + }); + Ok(()) + } + + fn dispatch_advisory( + &self, + _: &str, + x: Box>, + ) -> Result<(), storage::StorageError> { + if let Some(x) = *x { + let nvt: Nvt = x.into(); + let rt = tokio::runtime::Builder::new_current_thread() + .build() + .expect("Expected to be able to build a thread"); + rt.block_on(async { + let mut nvts = self.nvts.write().await; + nvts.insert(nvt); + }); + } + Ok(()) + } +} + impl Storage where E: crate::crypt::Crypt + Send + Sync + 'static, { - pub fn new(crypter: E) -> Self { + pub fn new(crypter: E, nasl_feed_path: S, notus_feed_path: S) -> Self + where + S: AsRef, + { Self { scans: RwLock::new(HashMap::new()), - oids: RwLock::new(vec![]), + nvts: Arc::new(RwLock::new(HashSet::with_capacity(100000))), hash: RwLock::new(String::new()), client_id: RwLock::new(vec![]), crypter, + feed_version: Arc::new(RwLock::new(String::new())), + // TODO cleanup + nasl_feed_path: Arc::new(nasl_feed_path.as_ref().to_path_buf()), + + notus_feed_path: Arc::new(notus_feed_path.as_ref().to_path_buf()), } } @@ -61,7 +126,11 @@ where impl Default for Storage { fn default() -> Self { - Self::new(crate::crypt::ChaCha20Crypt::default()) + Self::new( + crate::crypt::ChaCha20Crypt::default(), + "/var/lib/openvas/feed".to_string(), + "/var/lib/notus/feed".to_string(), + ) } } @@ -229,24 +298,98 @@ where } } +impl From for Error { + fn from(value: feed::VerifyError) -> Self { + Error::Storage(Box::new(value)) + } +} +impl From for Error { + fn from(value: feed::UpdateError) -> Self { + Error::Storage(Box::new(value)) + } +} +impl From for Error { + fn from(value: notus::error::Error) -> Self { + Error::Storage(Box::new(value)) + } +} #[async_trait] -impl OIDStorer for Storage +impl NVTStorer for Storage where E: Send + Sync + 'static, { - async fn push_oids(&self, hash: String, mut oids: Vec) -> Result<(), Error> { - let mut o = self.oids.write().await; - o.clear(); - o.append(&mut oids); - o.shrink_to_fit(); - let mut f = self.hash.write().await; - *f = hash; - Ok(()) + async fn synchronize_feeds(&self, hash: String) -> Result<(), Error> { + tracing::debug!("starting feed update in memory"); + let mut h = self.hash.write().await; + *h = hash; + drop(h); + + let notus_feed_path = self.notus_feed_path.clone(); + let nvts = self.nvts.clone(); + let notus_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting notus feed update"); + let loader = FSPluginLoader::new(notus_feed_path.as_ref()); + let advisories_files = HashsumAdvisoryLoader::new(loader.clone())?; + for filename in advisories_files.get_advisories()?.iter() { + let advisories = advisories_files.load_advisory(filename)?; + + for adv in advisories.advisories { + let data = models::VulnerabilityData { + adv, + famile: advisories.family.clone(), + filename: filename.to_owned(), + }; + let nvt: Nvt = data.into(); + + let rt = tokio::runtime::Builder::new_current_thread() + .build() + .expect("Expected to be able to build a thread"); + rt.block_on(async { + let mut nvts = nvts.write().await; + nvts.insert(nvt); + }); + } + } + tracing::debug!("finished notus feed update"); + Ok(()) + }); + + let nvts = self.nvts.clone(); + let feed_version = self.feed_version.clone(); + let nasl_feed_path = self.nasl_feed_path.clone(); + let active_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting nasl feed update"); + let oversion = "0.1"; + let loader = FSPluginLoader::new(nasl_feed_path.as_ref()); + let verifier = feed::HashSumNameLoader::sha256(&loader)?; + + let store = PerItemDispatcher::new(Dispa { nvts, feed_version }); + let mut fu = feed::Update::init(oversion, 5, loader.clone(), store, verifier); + if let Some(x) = fu.find_map(|x| x.err()) { + Err(Error::from(x)) + } else { + tracing::debug!("finished nasl feed update"); + Ok(()) + } + }); + + let nasl_result = active_feed.await.unwrap(); + let notus_result: Result<(), Error> = notus_feed.await.unwrap(); + tracing::debug!("finished feed update"); + + match (nasl_result, notus_result) { + (Ok(_), Ok(_)) => Ok(()), + (Ok(_), Err(err)) => Err(err), + (Err(err), Ok(_)) => Err(err), + (Err(err), Err(_)) => Err(err), + } } - async fn oids(&self) -> Result + Send>, Error> { - let o = self.oids.read().await.clone(); - Ok(Box::new(o.into_iter())) + async fn vts<'a>( + &self, + ) -> Result + Send + 'a>, Error> { + let o = self.nvts.read().await.clone().into_iter(); + Ok(Box::new(o)) } async fn feed_hash(&self) -> String { diff --git a/rust/openvasd/src/storage/mod.rs b/rust/openvasd/src/storage/mod.rs index 778a62357..bd6978cec 100644 --- a/rust/openvasd/src/storage/mod.rs +++ b/rust/openvasd/src/storage/mod.rs @@ -1,5 +1,6 @@ pub mod file; pub mod inmemory; +pub mod redis; use std::{collections::HashMap, sync::Arc}; use async_trait::async_trait; @@ -98,18 +99,38 @@ pub trait ProgressGetter { } #[async_trait] -/// A trait for storing and retrieving oids. +/// Handles NVT specifics. /// -/// OIDs are usually retrieved by scanning the feed, although the initial impulse would be to just -/// delete all oids and append new OIDs when finding them. However in a standard scenario the OID -/// list is used to gather capabilities of that particular scanner. To enforce overriding only when -/// all OIDs are gathered it just allows push of all OIDs at once. -pub trait OIDStorer { - /// Overrides oids - async fn push_oids(&self, hash: String, oids: Vec) -> Result<(), Error>; +/// Usually it parses nasl feed and notus feed to generate and store nvts. +pub trait NVTStorer { + /// Synchronizes feed based on the given hash. + /// + /// This method is called when the sha256sums is changed. It will then go through the feed + /// directories and update the meta information. + async fn synchronize_feeds(&self, hash: String) -> Result<(), Error>; + + + /// Retrieves just all oids. + async fn oids(&self) -> Result + Send>, Error> { + let vts = self.vts().await?; + Ok(Box::new(vts.map(|x|x.oid))) + } + + /// Retrieves NVTs. + async fn vts<'a>( + &self, + ) -> Result + Send + 'a>, Error>; - async fn oids(&self) -> Result + Send>, Error>; + /// Retrieves a NVT. + /// + async fn vt_by_oid( + &self, + oid: &str, + ) -> Result, Error> { + Ok(self.vts().await?.find(|x|x.oid == oid)) + } + /// Returns the currently stored feed hash. async fn feed_hash(&self) -> String; } @@ -139,12 +160,12 @@ pub trait AppendFetchResult { #[async_trait] /// Combines the traits `ProgressGetter`, `ScanStorer` and `AppendFetchResult`. pub trait Storage: - ProgressGetter + ScanStorer + AppendFetchResult + OIDStorer + ScanIDClientMapper + ProgressGetter + ScanStorer + AppendFetchResult + NVTStorer + ScanIDClientMapper { } #[async_trait] impl Storage for T where - T: ProgressGetter + ScanStorer + AppendFetchResult + OIDStorer + ScanIDClientMapper + T: ProgressGetter + ScanStorer + AppendFetchResult + NVTStorer + ScanIDClientMapper { } diff --git a/rust/openvasd/src/storage/redis.rs b/rust/openvasd/src/storage/redis.rs new file mode 100644 index 000000000..27ea8933a --- /dev/null +++ b/rust/openvasd/src/storage/redis.rs @@ -0,0 +1,288 @@ +use std::{ + path::{Path, PathBuf}, + sync::Arc, +}; + +use async_trait::async_trait; +use nasl_interpreter::FSPluginLoader; +use notus::loader::{hashsum::HashsumAdvisoryLoader, AdvisoryLoader}; +use redis_storage::{ + CacheDispatcher, RedisCtx, RedisGetNvt, RedisWrapper, FEEDUPDATE_SELECTOR, NOTUSUPDATE_SELECTOR, +}; +use storage::{item::PerItemDispatcher, Dispatcher, Field}; +use tokio::sync::RwLock; + +use crate::{controller::ClientHash, scan::FetchResult}; + +use super::{AppendFetchResult, Error, NVTStorer, ProgressGetter, ScanIDClientMapper, ScanStorer}; + +pub struct Storage { + hash: RwLock, + nasl_feed_path: Arc, + notus_feed_path: Arc, + url: String, + underlying: T, +} + +impl Storage { + pub fn new

(underlying: T, url: String, nasl_feed_path: P, notus_feed_path: P) -> Storage + where + P: AsRef, + { + Storage { + hash: RwLock::new(String::new()), + nasl_feed_path: Arc::new(nasl_feed_path.as_ref().to_path_buf()), + notus_feed_path: Arc::new(notus_feed_path.as_ref().to_path_buf()), + url, + underlying, + } + } +} + +#[async_trait] +impl ScanIDClientMapper for Storage +where + T: super::Storage + std::marker::Sync, +{ + async fn add_scan_client_id( + &self, + scan_id: String, + client_id: ClientHash, + ) -> Result<(), Error> { + self.underlying.add_scan_client_id(scan_id, client_id).await + } + async fn remove_scan_id(&self, scan_id: I) -> Result<(), Error> + where + I: AsRef + Send + 'static, + { + self.underlying.remove_scan_id(scan_id).await + } + + async fn get_scans_of_client_id(&self, client_id: &ClientHash) -> Result, Error> { + self.underlying.get_scans_of_client_id(client_id).await + } +} + +#[async_trait] +impl ProgressGetter for Storage +where + T: super::Storage + std::marker::Sync, +{ + async fn get_scan(&self, id: &str) -> Result<(models::Scan, models::Status), Error> { + self.underlying.get_scan(id).await + } + + async fn get_decrypted_scan(&self, id: &str) -> Result<(models::Scan, models::Status), Error> { + self.underlying.get_decrypted_scan(id).await + } + + async fn get_scan_ids(&self) -> Result, Error> { + self.underlying.get_scan_ids().await + } + + async fn get_status(&self, id: &str) -> Result { + self.underlying.get_status(id).await + } + + async fn get_results( + &self, + id: &str, + from: Option, + to: Option, + ) -> Result> + Send>, Error> { + self.underlying.get_results(id, from, to).await + } +} + +impl From for super::Error { + fn from(value: redis_storage::dberror::DbError) -> Self { + super::Error::Storage(Box::new(value)) + } +} + +impl From for super::Error { + fn from(value: storage::StorageError) -> Self { + super::Error::Storage(Box::new(value)) + } +} + +#[async_trait] +impl NVTStorer for Storage +where + T: super::Storage + std::marker::Sync, +{ + async fn synchronize_feeds(&self, hash: String) -> Result<(), Error> { + let mut h = self.hash.write().await; + *h = hash; + let url = Arc::new(self.url.to_string()); + let notus_feed_path = self.notus_feed_path.clone(); + let notus_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting notus feed update"); + let loader = FSPluginLoader::new(notus_feed_path.as_ref()); + let advisories_files = HashsumAdvisoryLoader::new(loader.clone())?; + + let redis_cache: CacheDispatcher = + redis_storage::CacheDispatcher::init(&url, NOTUSUPDATE_SELECTOR)?; + let store = PerItemDispatcher::new(redis_cache); + for filename in advisories_files.get_advisories()?.iter() { + let advisories = advisories_files.load_advisory(filename)?; + + for adv in advisories.advisories { + let data = models::VulnerabilityData { + adv, + famile: advisories.family.clone(), + filename: filename.to_owned(), + }; + store.dispatch(&"".to_string(), Field::NotusAdvisory(Box::new(Some(data))))?; + } + } + store.dispatch(&"".to_string(), Field::NotusAdvisory(Box::new(None)))?; + tracing::debug!("finished notus feed update"); + Ok(()) + }); + + let nasl_feed_path = self.nasl_feed_path.clone(); + let url = Arc::new(self.url.to_string()); + let active_feed = tokio::task::spawn_blocking(move || { + tracing::debug!("starting nasl feed update"); + let oversion = "0.1"; + let loader = FSPluginLoader::new(nasl_feed_path.as_ref()); + let verifier = feed::HashSumNameLoader::sha256(&loader)?; + + let redis_cache: CacheDispatcher = + redis_storage::CacheDispatcher::init(&url, FEEDUPDATE_SELECTOR)?; + let store = PerItemDispatcher::new(redis_cache); + let mut fu = feed::Update::init(oversion, 5, loader.clone(), store, verifier); + if let Some(x) = fu.find_map(|x| x.err()) { + Err(Error::from(x)) + } else { + tracing::debug!("finished nasl feed update"); + Ok(()) + } + }); + + let nasl_result = active_feed.await.unwrap(); + let notus_result: Result<(), Error> = notus_feed.await.unwrap(); + tracing::debug!("finished feed update"); + + match (nasl_result, notus_result) { + (Ok(_), Ok(_)) => Ok(()), + (Ok(_), Err(err)) => Err(err), + (Err(err), Ok(_)) => Err(err), + (Err(err), Err(_)) => Err(err), + } + } + + async fn vt_by_oid(&self, oid: &str) -> Result, Error> { + let url = self.url.to_string(); + let aoid = oid.to_owned(); + let nr = tokio::task::spawn_blocking(move || { + let mut notus_redis = RedisCtx::open(&url, NOTUSUPDATE_SELECTOR)?; + notus_redis.redis_get_advisory(&aoid) + }) + .await + .unwrap()?; + if nr.is_some() { + return Ok(nr); + } + + let aoid = oid.to_owned(); + let url = self.url.to_string(); + let nr = tokio::task::spawn_blocking(move || { + let mut nvt_redis = RedisCtx::open(&url, FEEDUPDATE_SELECTOR)?; + nvt_redis.redis_get_advisory(&aoid) + }) + .await + .unwrap()?; + Ok(nr) + } + async fn vts<'a>( + &self, + ) -> Result + Send + 'a>, Error> { + let url = self.url.to_string(); + let noids = tokio::task::spawn_blocking(move || { + let mut notus_redis = RedisCtx::open(&url, NOTUSUPDATE_SELECTOR)?; + let noids = notus_redis + .keys("internal*")? + .into_iter() + .filter_map(|x| x.split('/').last().map(|x| x.to_string())) + .filter_map(move |oid| notus_redis.redis_get_advisory(&oid).ok()) + .flatten(); + Ok::<_, Error>(noids) + }); + + let url = self.url.to_string(); + let foids = tokio::task::spawn_blocking(move || { + let mut nvt_redis = RedisCtx::open(&url, FEEDUPDATE_SELECTOR)?; + let foids = nvt_redis + .keys("nvt:*")? + .into_iter() + .filter_map(|x| x.split('/').last().map(|x| x.to_string())) + .filter_map(move |oid| nvt_redis.redis_get_vt(&oid).ok()) + .flatten(); + Ok::<_, Error>(foids) + }); + + let noids = noids.await.unwrap()?; + let foids = foids.await.unwrap()?; + let results = noids.chain(foids); + Ok(Box::new(results)) + } + + async fn oids(&self) -> Result + Send>, Error> { + let url = Arc::new(self.url.to_string()); + let noids = tokio::task::spawn_blocking(move || { + let mut notus_redis = RedisCtx::open(&url, NOTUSUPDATE_SELECTOR)?; + let noids = notus_redis + .keys("internal*")? + .into_iter() + .filter_map(|x| x.split('/').last().map(|x| x.to_string())); + Ok::<_, Error>(noids) + }); + + let url = Arc::new(self.url.to_string()); + let foids = tokio::task::spawn_blocking(move || { + let mut nvt_redis = RedisCtx::open(&url, FEEDUPDATE_SELECTOR)?; + let foids = nvt_redis + .keys("nvt:*")? + .into_iter() + .filter_map(|x| x.split('/').last().map(|x| x.to_string())); + Ok::<_, Error>(foids) + }); + + let noids = noids.await.unwrap()?; + let foids = foids.await.unwrap()?; + let results = noids.chain(foids); + Ok(Box::new(results)) + } + + async fn feed_hash(&self) -> String { + self.hash.read().await.to_string() + } +} + +#[async_trait] +impl ScanStorer for Storage +where + T: super::Storage + std::marker::Sync, +{ + async fn insert_scan(&self, t: models::Scan) -> Result<(), Error> { + self.underlying.insert_scan(t).await + } + async fn remove_scan(&self, id: &str) -> Result<(), Error> { + self.underlying.remove_scan(id).await + } + async fn update_status(&self, id: &str, status: models::Status) -> Result<(), Error> { + self.underlying.update_status(id, status).await + } +} + +#[async_trait] +impl AppendFetchResult for Storage +where + T: super::Storage + std::marker::Sync, +{ + async fn append_fetched_result(&self, id: &str, results: FetchResult) -> Result<(), Error> { + self.underlying.append_fetched_result(id, results).await + } +} diff --git a/rust/redis-storage/src/connector.rs b/rust/redis-storage/src/connector.rs index cb282187a..5bb8a2fd4 100644 --- a/rust/redis-storage/src/connector.rs +++ b/rust/redis-storage/src/connector.rs @@ -23,9 +23,8 @@ use storage::item::PerItemDispatcher; use storage::item::TagKey; use storage::item::TagValue; use storage::Kb; -use storage::ListRetriever; -use storage::Notus; -use storage::Retriever; +use storage::NotusAdvisory; + use storage::StorageError; enum KbNvtPos { @@ -128,7 +127,7 @@ pub enum NameSpaceSelector { } const CACHE_KEY: &str = "nvticache"; -pub const NOTUS_KEY: &str = "notuscache"; +const NOTUS_KEY: &str = "notuscache"; const DB_INDEX: &str = "GVM.__GlobalDBIndex"; impl NameSpaceSelector { @@ -263,9 +262,21 @@ pub trait RedisAddAdvisory: RedisWrapper { /// - 'nvt:': stores the general metadata ordered following the KbNvtPos indexes /// - 'oid::prefs': stores the plugins preferences, including the script_timeout /// (which is especial and uses preferences id 0) - fn redis_add_advisory(&mut self, key: &str, adv: Notus) -> RedisStorageResult<()> { - let value = adv.value.to_string(); - self.rpush(key, &value)?; + fn redis_add_advisory( + &mut self, + _: &str, + adv: Option, + ) -> RedisStorageResult<()> { + match adv { + Some(data) => { + let key = format!("internal/notus/advisories/{}", &data.adv.oid); + let value = models::Vulnerability::from(data); + let value = serde_json::to_string(&value) + .map_err(|e| DbError::Unknown(format!("Serialization error: {e}")))?; + self.rpush(&key, value)?; + } + None => self.rpush(NOTUS_KEY, "1".to_string())?, + }; Ok(()) } } @@ -298,7 +309,10 @@ pub trait RedisGetNvt: RedisWrapper { let mut prefs_list = self.lrange(&keyname, 0, -1)?; let mut prefs: Vec = Vec::new(); for p in prefs_list.iter_mut() { - if let Some(sp) = p.splitn(4, "|||").collect_tuple::<(&str, &str, &str, &str)>(){ + if let Some(sp) = p + .splitn(4, "|||") + .collect_tuple::<(&str, &str, &str, &str)>() + { prefs.push(NvtPreference::from(sp)); } } @@ -309,9 +323,11 @@ pub trait RedisGetNvt: RedisWrapper { fn get_tags(tags: &str) -> BTreeMap { let mut tag_map = BTreeMap::new(); - let tag_list = tags - .split('|') - .map(|x| x.splitn(2, '=').collect_tuple::<(&str, &str)>().unwrap_or_default()); + let tag_list = tags.split('|').map(|x| { + x.splitn(2, '=') + .collect_tuple::<(&str, &str)>() + .unwrap_or_default() + }); for (k, v) in tag_list.into_iter() { if let Ok(tk) = TagKey::from_str(k) { @@ -586,53 +602,6 @@ impl RedisCtx { } } -#[derive(Debug, Default)] -pub struct VtHelper -where - R: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt + Sync + Send, - K: AsRef, -{ - pub notus: CacheDispatcher, - pub vts: CacheDispatcher, -} - -impl VtHelper -where - R: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt + Sync + Send, - K: AsRef, -{ - pub fn new(notus: CacheDispatcher, vts: CacheDispatcher) -> Self { - Self { notus, vts } - } - - pub fn get_oids(&self) -> Result, StorageError> { - let mut oids: Vec = Vec::new(); - if let Ok(vts) = self.vts.retrieve_keys("nvt:*") { - oids.append(&mut vts.iter().map(|x| x[4..].to_string()).collect()); - } - if let Ok(notus) = self.notus.retrieve_keys("internal*") { - oids.append( - &mut notus - .iter() - .map(|x| x.split('/').last().unwrap_or_default().to_string()) - .collect(), - ); - } - - Ok(oids) - } - - pub fn retrieve_single_nvt(&self, oid: &str) -> Result, StorageError> { - let nvt = self.notus.retrieve_advisory(oid)?; - if nvt.is_some() { - Ok(nvt) - } else { - self.vts.retrieve_nvt(oid) - } - } - -} - /// Cache implementation. /// /// This implementation is thread-safe as it stored the underlying RedisCtx within a lockable arc reference. @@ -693,6 +662,8 @@ where .map_err(|e| DbError::SystemError(format!("{e:?}")))?; cache.delete_namespace() } + + } impl storage::item::ItemDispatcher for CacheDispatcher @@ -715,24 +686,9 @@ where kbs.push(kb); Ok(()) } - fn dispatch_advisory(&self, key: &str, adv: storage::Notus) -> Result<(), StorageError> { + fn dispatch_advisory(&self, key: &str, adv: Box>) -> Result<(), StorageError> { let mut cache = Arc::as_ref(&self.cache).lock()?; - cache.redis_add_advisory(key, adv).map_err(|e| e.into()) - } -} - -impl storage::ListRetriever for CacheDispatcher -where - S: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt, - K: AsRef, -{ - fn retrieve_keys(&self, pattern: &str) -> Result, StorageError> { - let mut cache = self.cache.lock().map_err(StorageError::from)?; - Ok(cache - .keys(pattern.as_ref())? - .iter() - .map(|x| x.to_string()) - .collect()) + cache.redis_add_advisory(key, *adv).map_err(|e| e.into()) } } @@ -741,41 +697,39 @@ where S: RedisWrapper + RedisAddNvt + RedisAddAdvisory + RedisGetNvt, K: AsRef, { - fn retrieve_nvt(&self, oid: &str) -> Result, StorageError> { - let mut cache = Arc::as_ref(&self.cache).lock()?; - cache.redis_get_vt(oid.as_ref()).map_err(|e| e.into()) - } - fn retrieve_advisory(&self, oid: &str) -> Result, StorageError> { - let mut cache = Arc::as_ref(&self.cache).lock()?; - cache.redis_get_advisory(oid.as_ref()).map_err(|e| e.into()) - } - fn retrieve( &self, _: &K, - scope: &storage::Retrieve, - ) -> Result, StorageError> { + scope: storage::Retrieve, + ) -> Result>, StorageError> { Ok(match scope { - // currently not supported - storage::Retrieve::NVT(_) => Vec::new(), - storage::Retrieve::NOTUS(_) => Vec::new(), - storage::Retrieve::KB(s) => { - let kbs = self.kbs.lock().map_err(StorageError::from)?; - kbs.iter() - .filter(|x| &x.key == s) - .map(|x| storage::Field::KB(x.clone())) - .collect() + // retrieve all nvts + // storage::Retrieve::NVT(None) => { + // let mut cache = Arc::as_ref(&self.cache).lock()?; + // let stored = cache.redis_get_vt(oid.as_ref()).map_err(|e| e.into())?; + // let result = stored.as_slice().into_iter().map(|x|storage::Field::NVT(x)); + // Ok(result) + // + // } + storage::Retrieve::NotusAdvisory(_) | storage::Retrieve::NVT(_) => { + Box::new(Vec::new().into_iter()) } + storage::Retrieve::KB(s) => Box::new({ + let kbs = self.kbs.lock().map_err(StorageError::from)?; + let kbs = kbs.clone(); + kbs.into_iter() + .filter(move |x| x.key == s) + .map(move |x| storage::Field::KB(x.clone())) + }), }) } fn retrieve_by_field( &self, - _: &storage::Field, - _: &storage::Retrieve, - ) -> Result)>, StorageError> { - // currently not supported - Ok(vec![]) + _field: storage::Field, + _scope: storage::Retrieve, + ) -> Result>, StorageError> { + todo!() } } @@ -785,7 +739,6 @@ mod tests { use std::sync::mpsc::{self, Sender, TryRecvError}; use std::sync::{Arc, Mutex}; - use redis::ToRedisArgs; use storage::item::PerItemDispatcher; use storage::item::{NvtPreference, NvtRef, PreferenceType, TagKey, TagValue, ACT}; use storage::Dispatcher; @@ -820,21 +773,21 @@ mod tests { } fn lindex( &mut self, - key: &str, - index: isize, + _: &str, + _: isize, ) -> crate::dberror::RedisStorageResult { Ok(String::new()) } - fn keys(&mut self, pattern: &str) -> crate::dberror::RedisStorageResult> { + fn keys(&mut self, _: &str) -> crate::dberror::RedisStorageResult> { Ok(Vec::new()) } fn lrange( &mut self, - key: &str, - start: isize, - end: isize, + _: &str, + _: isize, + _: isize, ) -> crate::dberror::RedisStorageResult> { Ok(Vec::new()) } diff --git a/rust/redis-storage/src/lib.rs b/rust/redis-storage/src/lib.rs index 94b6a5d47..f50c22dc7 100644 --- a/rust/redis-storage/src/lib.rs +++ b/rust/redis-storage/src/lib.rs @@ -6,10 +6,11 @@ /// Module with structures and methods to access redis. mod connector; pub use connector::{ - CacheDispatcher, RedisAddAdvisory, RedisAddNvt, RedisCtx, RedisGetNvt, RedisWrapper, VtHelper, + CacheDispatcher, RedisAddAdvisory, RedisAddNvt, RedisCtx, RedisGetNvt, RedisWrapper, }; /// Module to handle custom errors pub mod dberror; +pub use connector::NameSpaceSelector; /// Default selector for feed update pub use connector::FEEDUPDATE_SELECTOR; -pub use connector::{NOTUSUPDATE_SELECTOR, NOTUS_KEY}; +pub use connector::NOTUSUPDATE_SELECTOR; diff --git a/rust/scanconfig/src/lib.rs b/rust/scanconfig/src/lib.rs index f17aa2b9d..4885a6812 100644 --- a/rust/scanconfig/src/lib.rs +++ b/rust/scanconfig/src/lib.rs @@ -222,27 +222,25 @@ where use storage::Field; use storage::Retrieve; match retriever.retrieve_by_field( - &Field::NVT(NVTField::Family(s.family_or_nvt.clone())), - &Retrieve::NVT(Some(NVTKey::Oid)), + Field::NVT(NVTField::Family(s.family_or_nvt.clone())), + Retrieve::NVT(Some(NVTKey::Oid)), ) { Ok(nvt) => { + let result: Vec<_> = nvt + .flat_map(|(_, f)| match &f { + Field::NVT(NVTField::Oid(oid)) if is_not_already_present(oid) => { + Some(oid_to_vt(oid)) + } + _ => None, + }) + .collect(); + tracing::debug!( "found {} nvt entries for family {}", - nvt.len(), + result.len(), s.family_or_nvt ); - nvt.iter() - .flat_map(|(_, f)| { - f.iter().filter_map(|f| match f { - Field::NVT(NVTField::Oid(oid)) - if is_not_already_present(oid) => - { - Some(oid_to_vt(oid)) - } - _ => None, - }) - }) - .collect() + result } Err(e) => vec![Err(e.into())], } diff --git a/rust/storage/Cargo.toml b/rust/storage/Cargo.toml index 9438f0765..85d2dbf94 100644 --- a/rust/storage/Cargo.toml +++ b/rust/storage/Cargo.toml @@ -9,8 +9,11 @@ license = "GPL-2.0-or-later" [dependencies] time = {version = "0", features = ["parsing"]} serde = { version = "1.0", features = ["derive"], optional = true } +bincode = {version = "2.0.0-rc.3", optional = true } tracing = "0.1.37" models = { path = "../models" } [features] +default = ["serde_support", "bincode_support"] serde_support = ["serde"] +bincode_support = ["bincode"] diff --git a/rust/storage/src/item.rs b/rust/storage/src/item.rs index b78e56375..baee48ed0 100644 --- a/rust/storage/src/item.rs +++ b/rust/storage/src/item.rs @@ -11,9 +11,11 @@ use std::{ sync::{Arc, Mutex}, }; -use models::Vulnerability; +use models::{Vulnerability, VulnerabilityData}; -use crate::{time::AsUnixTimeStamp, types, Dispatcher, Field, Kb, Notus, Retriever, StorageError}; +use crate::{ + time::AsUnixTimeStamp, types, Dispatcher, Field, Kb, NotusAdvisory, Retriever, StorageError, +}; /// Attack Category either set by script_category /// @@ -40,12 +42,13 @@ use crate::{time::AsUnixTimeStamp, types, Dispatcher, Field, Kb, Notus, Retrieve /// /// It is defined as a numeric value instead of string representations due to downwards compatible reasons. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd, Default)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd, Default, Hash)] #[cfg_attr( feature = "serde_support", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] pub enum ACT { /// Defines a initializer Init, @@ -98,11 +101,12 @@ impl FromStr for ACT { macro_rules! make_str_lookup_enum { ($enum_name:ident: $doc:expr => { $($matcher:ident => $key:ident),+ }) => { #[doc = $doc] - #[derive(Clone, Copy, Debug, PartialEq, Eq, Ord,PartialOrd)] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Ord,PartialOrd, Hash)] #[cfg_attr(feature = "serde_support", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] + #[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] pub enum $enum_name { $( #[doc = concat!(stringify!($matcher))] @@ -238,8 +242,9 @@ macro_rules! make_nvt_fields { }; } +// "The full NVT" => Nvt(Nvt), make_nvt_fields! { - "Is an identifying field" => Oid(String), + "Is an identifying field" => Oid(String), "The filename of the NASL Plugin The filename is set on a description run and is not read from the NASL script." => FileName(String), @@ -279,17 +284,19 @@ Category will be used to identify the type of the NASL plugin."### => Category(ACT), r###"Family"### => Family(String), + "Get complete NVTs" => Nvt(Nvt), r###"For deprecated functions"### => NoOp } /// Preferences that can be set by a user when running a script. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr( feature = "serde_support", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] pub struct NvtPreference { /// Preference ID pub id: Option, @@ -302,12 +309,13 @@ pub struct NvtPreference { } /// References defines where the information for that vulnerability attack is from. -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr( feature = "serde_support", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "snake_case") )] +#[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] pub struct NvtRef { /// Reference type ("cve", "bid", ...) pub class: String, @@ -416,7 +424,8 @@ impl TagValue { } } -#[derive(Clone, Debug, Default, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] #[cfg_attr( feature = "serde_support", derive(serde::Serialize, serde::Deserialize), @@ -454,6 +463,14 @@ pub struct Nvt { pub family: String, } +impl From for Nvt { + fn from(value: VulnerabilityData) -> Self { + let oid = value.adv.oid.clone(); + let v: Vulnerability = value.into(); + (&oid as &str, v).into() + } +} + impl From<(&str, Vulnerability)> for Nvt { fn from(v: (&str, Vulnerability)) -> Nvt { fn tag_to_vec(v: &Vulnerability) -> BTreeMap { @@ -534,12 +551,6 @@ impl From<(&str, Vulnerability)> for Nvt { } } } -/// Is a specialized Retriever for NVT information -pub trait ItemRetriever { - /// Retrieves NVT information stored - fn retrieve_single_nvt(&self, oid: &str) -> Result; -} - /// Is a specialized Dispatcher for NVT information within the description block. pub trait ItemDispatcher { /// Dispatches the feed version as well as NVT. @@ -552,19 +563,16 @@ pub trait ItemDispatcher { fn dispatch_feed_version(&self, version: String) -> Result<(), StorageError>; /// Dispatches a knowledge base item. /// - /// Usually the NvtDispatcher is used on description = 1 runs were no KB item should occur. But + /// Usually the ItemDispatcher is used on description = 1 runs were no KB item should occur. But /// to have the possibility to have shared run this interface should allow to handle it /// accordingly. /// The default is set to return `Ok(())` without doing something to net enforce every - /// NvtDispatcher to implement it. + /// ItemDispatcher to implement it. fn dispatch_kb(&self, _: &K, _: Kb) -> Result<(), StorageError> { Ok(()) } /// Stores an advisory - - fn dispatch_advisory(&self, _: &str, _: Notus) -> Result<(), StorageError> { - Ok(()) - } + fn dispatch_advisory(&self, _: &str, _: Box>) -> Result<(), StorageError>; } /// Collects the information while being in a description run and calls the dispatch method @@ -583,7 +591,7 @@ where S: ItemDispatcher, K: AsRef, { - /// Creates a new NvtDispatcher without a feed_version and nvt. + /// Creates a new ItemDispatcher without a feed_version and nvt. pub fn new(dispatcher: S) -> Self { Self { nvt: Arc::new(Mutex::new(None)), @@ -598,7 +606,6 @@ where .map_err(|x| StorageError::Dirty(format!("{x}")))?; let mut nvt = data.clone().unwrap_or_default(); - // TODO optimize match f { NVTField::Oid(oid) => nvt.oid = oid, NVTField::FileName(s) => nvt.filename = s, @@ -620,6 +627,7 @@ where NVTField::Category(s) => nvt.category = s, NVTField::Family(s) => nvt.family = s, NVTField::NoOp => {} + NVTField::Nvt(x) => nvt = x, }; *data = Some(nvt); Ok(()) @@ -635,7 +643,7 @@ where match scope { Field::NVT(nvt) => self.store_nvt_field(nvt), Field::KB(kb) => self.dispatcher.dispatch_kb(key, kb), - Field::NOTUS(adv) => self.dispatcher.dispatch_advisory(key.as_ref(), adv), + Field::NotusAdvisory(adv) => self.dispatcher.dispatch_advisory(key.as_ref(), adv), } } @@ -655,15 +663,19 @@ where K: AsRef, S: ItemDispatcher + Retriever, { - fn retrieve(&self, key: &K, scope: &crate::Retrieve) -> Result, StorageError> { + fn retrieve( + &self, + key: &K, + scope: crate::Retrieve, + ) -> Result>, StorageError> { self.dispatcher.retrieve(key, scope) } fn retrieve_by_field( &self, - field: &Field, - scope: &crate::Retrieve, - ) -> Result)>, StorageError> { + field: Field, + scope: crate::Retrieve, + ) -> Result>, StorageError> { self.dispatcher.retrieve_by_field(field, scope) } } diff --git a/rust/storage/src/lib.rs b/rust/storage/src/lib.rs index 9594d26fa..9fde8a5ef 100644 --- a/rust/storage/src/lib.rs +++ b/rust/storage/src/lib.rs @@ -14,7 +14,7 @@ use std::{ fmt::Display, io, marker::PhantomData, - sync::{Arc, Mutex, PoisonError}, + sync::{Arc, PoisonError, RwLock}, }; use item::NVTField; @@ -40,18 +40,8 @@ pub struct Kb { pub expire: Option, } -#[derive(Clone, Debug, Default, PartialEq, Eq)] -#[cfg_attr( - feature = "serde_support", - derive(serde::Serialize, serde::Deserialize), - serde(rename_all = "snake_case") -)] - -/// Structure to hold a knowledge base item -pub struct Notus { - /// Notus advisory metadata - pub value: Primitive, -} +/// Redefine Vulnerability so that other libraries using that don't have to include models +pub type NotusAdvisory = models::VulnerabilityData; /// Describes various Fields of supported items. #[derive(Clone, Debug, PartialEq, Eq)] @@ -60,10 +50,13 @@ pub enum Field { NVT(NVTField), /// Knowledge Base item KB(Kb), - /// Notus advisories - NOTUS(Notus), + /// Notus advisories, when None then the impl can assume finish + NotusAdvisory(Box>), + } + + impl From for Field { fn from(value: NVTField) -> Self { Self::NVT(value) @@ -75,9 +68,9 @@ impl From for Field { Self::KB(value) } } -impl From for Field { - fn from(value: Notus) -> Self { - Self::NOTUS(value) +impl From for Field { + fn from(value: models::VulnerabilityData) -> Self { + Self::NotusAdvisory(Box::new(Some(value))) } } @@ -219,7 +212,7 @@ pub struct DefaultDispatcher { /// The data storage /// /// The memory access is managed via an Arc while the Mutex ensures that only one consumer at a time is accessing it. - data: Arc>, + data: Arc>, } impl DefaultDispatcher { @@ -234,7 +227,7 @@ impl DefaultDispatcher { /// Cleanses stored data. pub fn cleanse(&self) -> Result<(), StorageError> { - let mut data = Arc::as_ref(&self.data).lock()?; + let mut data = Arc::as_ref(&self.data).write()?; data.clear(); data.shrink_to_fit(); Ok(()) @@ -246,7 +239,7 @@ where K: AsRef + Display + Default + From + Send + Sync, { fn dispatch(&self, key: &K, scope: Field) -> Result<(), StorageError> { - let mut data = Arc::as_ref(&self.data).lock()?; + let mut data = Arc::as_ref(&self.data).write()?; match data.iter_mut().find(|(k, _)| k.as_str() == key.as_ref()) { Some((_, v)) => v.push(scope), None => data.push((key.as_ref().to_owned(), vec![scope])), @@ -264,40 +257,68 @@ where } } +/// Holds iterator in memory +pub struct InMemoryDataWrapper { + inner: Box>, +} + +impl InMemoryDataWrapper +where + T: 'static, +{ + /// Creates a new instance based on a Vector + pub fn new(v: Vec) -> InMemoryDataWrapper { + Self { + inner: Box::new(v.into_iter()), + } + } +} +impl Iterator for InMemoryDataWrapper { + type Item = T; + + fn next(&mut self) -> Option { + self.inner.next() + } +} + impl Retriever for DefaultDispatcher where - K: AsRef + Display + Default + From, + K: AsRef + Display + Default + From + 'static, { - fn retrieve(&self, key: &K, scope: &Retrieve) -> Result, StorageError> { - let data = Arc::as_ref(&self.data).lock()?; + fn retrieve( + &self, + key: &K, + scope: Retrieve, + ) -> Result>, StorageError> { + let data = Arc::as_ref(&self.data).read()?; + let data = InMemoryDataWrapper::new(data.clone()); let skey = key.to_string(); - let result = data - .iter() - .filter(|(k, _)| k == &skey) - .flat_map(|(_, v)| v.clone()) - .filter(|v| scope.for_field(v)) - .collect::>(); - Ok(result) + Ok(Box::new( + data.into_iter() + .filter(move |(k, _)| k == &skey) + .flat_map(|(_, v)| v.clone()) + .filter(move |v| scope.for_field(v)), + )) } fn retrieve_by_field( &self, - field: &Field, - scope: &Retrieve, - ) -> Result)>, StorageError> { - let data = Arc::as_ref(&self.data).lock()?; + field: Field, + scope: Retrieve, + ) -> Result>, StorageError> { + let data = Arc::as_ref(&self.data).read()?; tracing::debug!("Entries: {:?}", data.len()); + let data = InMemoryDataWrapper::new(data.clone()); let result = data - .iter() - .filter(|(_, v)| v.contains(field)) - .map(|(k, v)| { - ( - k.clone().into(), - v.iter().filter(|v| scope.for_field(v)).cloned().collect(), - ) - }) - .collect::)>>(); - Ok(result) + .into_iter() + .filter(move |(_, v)| v.contains(&field)) + .flat_map(move |(k, v)| { + let scope = scope.clone(); + v.into_iter() + .filter(move |v| scope.for_field(v)) + .map(move |v| (K::from(k.clone()), v)) + }); + Ok(Box::new(result)) } } @@ -315,20 +336,28 @@ mod tests { let key: String = Default::default(); storage.dispatch(&key, NVT(Oid("moep".to_owned())))?; assert_eq!( - storage.retrieve(&key, &Retrieve::NVT(None))?, + storage + .retrieve(&key, Retrieve::NVT(None))? + .collect::>(), vec![NVT(Oid("moep".to_owned()))] ); assert_eq!( - storage.retrieve(&key, &Retrieve::NVT(Some(NVTKey::Oid)))?, + storage + .retrieve(&key, Retrieve::NVT(Some(NVTKey::Oid)))? + .collect::>(), vec![NVT(Oid("moep".to_owned()))] ); assert_eq!( - storage.retrieve(&key, &Retrieve::NVT(Some(NVTKey::Family)))?, + storage + .retrieve(&key, Retrieve::NVT(Some(NVTKey::Family)))? + .collect::>(), vec![] ); assert_eq!( - storage.retrieve_by_field(&NVT(Oid("moep".to_owned())), &Retrieve::NVT(None))?, - vec![(key.clone(), vec![NVT(Oid("moep".to_owned()))])] + storage + .retrieve_by_field(NVT(Oid("moep".to_owned())), Retrieve::NVT(None))? + .collect::>(), + vec![(key.clone(), NVT(Oid("moep".to_owned())))] ); Ok(()) } diff --git a/rust/storage/src/retrieve.rs b/rust/storage/src/retrieve.rs index a660aee41..729e50133 100644 --- a/rust/storage/src/retrieve.rs +++ b/rust/storage/src/retrieve.rs @@ -5,7 +5,7 @@ use std::marker::PhantomData; use crate::{ - item::{NVTField, NVTKey, Nvt}, + item::{NVTField, NVTKey}, Field, StorageError, }; @@ -19,7 +19,7 @@ pub enum Retrieve { /// Knowledge Base item KB(String), /// Metadata of the Notus advisory - NOTUS(Option), + NotusAdvisory(Option), } impl Retrieve { @@ -28,7 +28,7 @@ impl Retrieve { match self { Retrieve::NVT(_) => "nvt", Retrieve::KB(_) => "kb", - Retrieve::NOTUS(_) => "notus", + Retrieve::NotusAdvisory(_) => "notus", } } @@ -67,6 +67,8 @@ impl Retrieve { NVTKey::Category => matches!(field, Field::NVT(NVTField::Category(_))), NVTKey::Family => matches!(field, Field::NVT(NVTField::Family(_))), NVTKey::NoOp => matches!(field, Field::NVT(NVTField::NoOp)), + // TODO: in memory and file should map in this case + NVTKey::Nvt => matches!(field, Field::NVT(NVTField::Nvt(_))), }, Retrieve::KB(s) => { @@ -77,38 +79,26 @@ impl Retrieve { } } - Retrieve::NOTUS(None) => matches!(field, Field::NOTUS(_)), - Retrieve::NOTUS(Some(_)) => matches!(field, Field::NOTUS(_)), + Retrieve::NotusAdvisory(_) => matches!(field, Field::NotusAdvisory(_)), } } } -/// Retrieves list of keys based on a key pattern. -pub trait ListRetriever { - /// Gets Fields find by key and scope. - fn retrieve_keys(&self, _pattern: &str) -> Result, StorageError>; -} - /// Retrieves fields based on a key and scope. pub trait Retriever { - /// Returns VT's metainformation to be sent to a client. - fn retrieve_nvt(&self, _oid: &str) -> Result, StorageError> { - Ok(Some(Nvt::default())) - } - /// Returns Advisories metainformation to be sent to a client. - fn retrieve_advisory(&self, _oid: &str) -> Result, StorageError> { - Ok(Some(Nvt::default())) - } - - /// Gets Fields find by key and scope. - fn retrieve(&self, key: &K, scope: &Retrieve) -> Result, StorageError>; + /// Gets Fields find by key and scope. This is to get all instances. + fn retrieve( + &self, + key: &K, + scope: Retrieve, + ) -> Result>, StorageError>; /// Gets Fields find by field and scope. fn retrieve_by_field( &self, - field: &Field, - scope: &Retrieve, - ) -> Result)>, StorageError>; + field: Field, + scope: Retrieve, + ) -> Result>, StorageError>; } /// A NoOpRetriever is for cases that don't require a retriever but it is needed due to contract. @@ -121,16 +111,20 @@ pub struct NoOpRetriever { phantom: PhantomData, } -impl Retriever for NoOpRetriever { - fn retrieve(&self, _: &K, _: &Retrieve) -> Result, StorageError> { - Ok(vec![]) +impl Retriever for NoOpRetriever { + fn retrieve( + &self, + _: &K, + _: Retrieve, + ) -> Result>, StorageError> { + Ok(Box::new(vec![].into_iter())) } fn retrieve_by_field( &self, - _: &Field, - _: &Retrieve, - ) -> Result)>, StorageError> { - Ok(vec![]) + _: Field, + _: Retrieve, + ) -> Result>, StorageError> { + Ok(Box::new(vec![].into_iter())) } } diff --git a/rust/storage/src/types.rs b/rust/storage/src/types.rs index 3007a97bf..26700ae73 100644 --- a/rust/storage/src/types.rs +++ b/rust/storage/src/types.rs @@ -6,12 +6,13 @@ use std::collections::HashMap; -#[derive(Clone, Debug, PartialEq, Eq, Default)] +#[derive(Clone, Debug, PartialEq, Eq, Default, Hash)] #[cfg_attr( feature = "serde_support", derive(serde::Serialize, serde::Deserialize), serde(untagged) )] +#[cfg_attr(feature = "bincode_support", derive(bincode::Encode, bincode::Decode))] /// Allowed type definitions pub enum Primitive { /// String value @@ -23,7 +24,7 @@ pub enum Primitive { /// Array value Array(Vec), /// Array value - Dict(HashMap), + Dict(Vec<(String, Primitive)>), /// Boolean value Boolean(bool), /// Null value @@ -75,7 +76,7 @@ impl From for Primitive { impl From> for Primitive { fn from(x: HashMap) -> Self { - Primitive::Dict(x) + Primitive::Dict(x.into_iter().collect()) } } diff --git a/rust/typos.toml b/rust/typos.toml index 3afa65c18..7067fe37a 100644 --- a/rust/typos.toml +++ b/rust/typos.toml @@ -3,4 +3,4 @@ OpenVAS = "OpenVAS" des_ede_cbc_encrypt = "des_ede_cbc_encrypt" [files] -extend-exclude = ["osp/tests/response_*.xml", "smoketest/configs/client_sample.cert"] +extend-exclude = ["osp/tests/response_*.xml", "smoketest/configs/client_sample.cert", "*.notus"]