Skip to content

Commit

Permalink
Add: some tests for notus and for http2 builtin nasl functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola authored and ArnoStiefvater committed May 15, 2024
1 parent 5d42bf8 commit 750791d
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 1 deletion.
1 change: 1 addition & 0 deletions rust/examples/feed/notus/advisories/sha256sums
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
008d57e47ad9096a69c1f8445662dec747993fb22517a5f786f4bb29eb18f9c4 test.notus
109a260a067ead43c5b7aff47b57c63ce0b68bf533da69201b2cf144aa09e244 windows.notus
54 changes: 54 additions & 0 deletions rust/examples/feed/notus/advisories/windows.notus
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version": "1.2",
"spdx-license-identifier": "GPL-2.0-only",
"copyright": "Copyright (C) 2008-2024 Greenbone Networks GmbH",
"family": "Windows Local Security Checks",
"advisories": [
{
"oid": "1.3.6.1.4.1.25623.1.1.1.1.2024.1000",
"title": "Windows: Security Advisory (DSA-137)",
"creation_date": 1200605086,
"last_modification": 1706776332,
"advisory_id": "DSA-137",
"advisory_xref": "https://www.debian.org/security/2002/DSA-137",
"cves": [
"CVE-2002-0658"
],
"summary": "The remote host is missing an update for the Debian 'mm' package(s) announced via the DSA-137 advisory.",
"insight": "Marcus Meissner and Sebastian Krahmer discovered and fixed a temporary file vulnerability in the mm shared memory library. This problem can be exploited to gain root access to a machine running Apache which is linked against this library, if shell access to the user 'www-data' is already available (which could easily be triggered through PHP).\n\nThis problem has been fixed in the upstream version 1.2.0 of mm, which will be uploaded to the unstable Debian distribution while this advisory is released. Fixed packages for potato (Debian 2.2) and woody (Debian 3.0) are linked below.\n\nWe recommend that you upgrade your libmm packages immediately and restart your Apache server.",
"affected": "'mm' package(s) on Debian 3.0.",
"xrefs": [
"https://security-tracker.debian.org/tracker/DSA-137"
],
"qod_type": "package",
"severity": {
"origin": "NVD",
"date": 1072933200,
"cvss_v2": "AV:L/AC:H/Au:N/C:C/I:C/A:C"
}
},
{
"oid": "1.3.6.1.4.1.25623.1.1.1.1.2024.1001",
"title": "Windows: Security Advisory (DSA-139)",
"creation_date": 1200605086,
"last_modification": 1706776332,
"advisory_id": "DSA-139",
"advisory_xref": "https://www.debian.org/security/2002/DSA-139",
"cves": [
"CVE-2002-0817"
],
"summary": "The remote host is missing an update for the Debian 'super' package(s) announced via the DSA-139 advisory.",
"insight": "GOBBLES found an insecure use of format strings in the super package. The included program super is intended to provide access to certain system users for particular users and programs, similar to the program sudo. Exploiting this format string vulnerability a local user can gain unauthorized root access.\n\nThis problem has been fixed in version 3.12.2-2.1 for the old stable distribution (potato), in version 3.16.1-1.1 for the current stable distribution (woody) and in version 3.18.0-3 for the unstable distribution (sid).\n\nWe recommend that you upgrade your super package immediately.",
"affected": "'super' package(s) on Debian 3.0.",
"xrefs": [
"https://security-tracker.debian.org/tracker/DSA-139"
],
"qod_type": "package",
"severity": {
"origin": "NVD",
"date": 1072933200,
"cvss_v2": "AV:L/AC:L/Au:N/C:C/I:C/A:C"
}
}
]
}
1 change: 1 addition & 0 deletions rust/examples/feed/notus/products/sha256sums
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
720805198332ce39e5f113bbc56b4effd337ddc350f0571e63d8fc069049007b test.notus
ce4fb0c02d3f0c9e35336a267314b0eca68a2bf22f09a1ac1dd3c0eac0f4998b windows_11_home.notus
29 changes: 29 additions & 0 deletions rust/examples/feed/notus/products/windows_11_home.notus
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "1.2",
"spdx-license-identifier": "GPL-2.0-only",
"copyright": "Copyright (C) 2008-2024 Greenbone Networks GmbH",
"package_type": "msp",
"product_name": "Windows 11 Home",
"advisories": [
{
"oid": "1.3.6.1.4.1.25623.1.1.1.1.2024.1000",
"fixed_packages": [
{
"name": "11.0.22631",
"full_version": "3447",
"specifier": ">="
}
]
},
{
"oid": "1.3.6.1.4.1.25623.1.1.1.1.2024.1001",
"fixed_packages": [
{
"name": "11.0.22632",
"full_version": "3447",
"specifier": ">="
}
]
}
]
}
20 changes: 20 additions & 0 deletions rust/examples/http2.nasl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: 2023 Greenbone AG
#
# SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

display("Starting...");
h = http2_handle();
display(h);

i = http2_set_custom_header(handle: h, header_item: "X-API-KEY: changeme");
i = http2_set_custom_header(handle: h, header_item: "content-type: application/json");

# valid for openvasd
r = http2_get(handle:h, port:3000, item:"/health/ready", schema:"https");
display("response: ", r);

rc = http2_get_response_code(handle:h);

display("return code: ", rc);

http2_close_handle(h);
2 changes: 1 addition & 1 deletion rust/openvasd/src/storage/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ mod tests {
);
memory_storage.synchronize_feeds(feeds).await.unwrap();
let amount_memory_oids = memory_storage.oids().await.unwrap().count();
assert_eq!(amount_memory_oids, 2);
assert_eq!(amount_memory_oids, 4);
assert_eq!(amount_memory_oids, amount_file_oids);
}

Expand Down

0 comments on commit 750791d

Please sign in to comment.