python-gvm 27.5.0__py3-none-any.whl → 27.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gvm/__version__.py +1 -1
- gvm/protocols/gmp/_gmpnext.py +166 -0
- gvm/protocols/gmp/requests/next/__init__.py +4 -0
- gvm/protocols/gmp/requests/next/_audit_report.py +39 -0
- gvm/protocols/gmp/requests/next/_report_hosts.py +39 -0
- gvm/protocols/gmp/requests/next/_scan_report.py +113 -0
- gvm/protocols/http/openvasd/_client.py +45 -31
- gvm/protocols/http/openvasd/_openvasd1.py +3 -0
- {python_gvm-27.5.0.dist-info → python_gvm-27.7.0.dist-info}/METADATA +4 -4
- {python_gvm-27.5.0.dist-info → python_gvm-27.7.0.dist-info}/RECORD +12 -10
- {python_gvm-27.5.0.dist-info → python_gvm-27.7.0.dist-info}/WHEEL +1 -1
- {python_gvm-27.5.0.dist-info → python_gvm-27.7.0.dist-info}/licenses/LICENSE +0 -0
gvm/__version__.py
CHANGED
gvm/protocols/gmp/_gmpnext.py
CHANGED
|
@@ -16,6 +16,7 @@ from .requests.next import (
|
|
|
16
16
|
AgentInstallerInstructions,
|
|
17
17
|
Agents,
|
|
18
18
|
AliveTest,
|
|
19
|
+
AuditReport,
|
|
19
20
|
Credentials,
|
|
20
21
|
CredentialStoreCredentialType,
|
|
21
22
|
CredentialStores,
|
|
@@ -30,12 +31,14 @@ from .requests.next import (
|
|
|
30
31
|
ReportPorts,
|
|
31
32
|
ReportTlsCertificates,
|
|
32
33
|
ReportVulnerabilities,
|
|
34
|
+
ScanReports,
|
|
33
35
|
Targets,
|
|
34
36
|
Tasks,
|
|
35
37
|
WebApplicationTargets,
|
|
36
38
|
)
|
|
37
39
|
from .requests.v224 import AliveTest as AliveTestV224
|
|
38
40
|
from .requests.v224 import HostsOrdering
|
|
41
|
+
from .requests.v226 import ReportFormatType
|
|
39
42
|
|
|
40
43
|
|
|
41
44
|
class GMPNext(GMPv227[T]):
|
|
@@ -1089,6 +1092,36 @@ class GMPNext(GMPv227[T]):
|
|
|
1089
1092
|
)
|
|
1090
1093
|
)
|
|
1091
1094
|
|
|
1095
|
+
def get_audit_report_hosts(
|
|
1096
|
+
self,
|
|
1097
|
+
report_id: EntityID,
|
|
1098
|
+
*,
|
|
1099
|
+
filter_string: str | None = None,
|
|
1100
|
+
filter_id: str | None = None,
|
|
1101
|
+
ignore_pagination: bool | None = None,
|
|
1102
|
+
details: bool | None = True,
|
|
1103
|
+
) -> T:
|
|
1104
|
+
"""Request hosts of a single audit report.
|
|
1105
|
+
|
|
1106
|
+
Args:
|
|
1107
|
+
report_id: UUID of an existing report.
|
|
1108
|
+
filter_string: Filter term to use to filter results in the report
|
|
1109
|
+
filter_id: UUID of filter to use to filter results in the report
|
|
1110
|
+
ignore_pagination: Whether to ignore the filter terms "first" and
|
|
1111
|
+
"rows".
|
|
1112
|
+
details: Request additional report host information details.
|
|
1113
|
+
Defaults to True.
|
|
1114
|
+
"""
|
|
1115
|
+
return self._send_request_and_transform_response(
|
|
1116
|
+
ReportHosts.get_audit_report_hosts(
|
|
1117
|
+
report_id=report_id,
|
|
1118
|
+
filter_string=filter_string,
|
|
1119
|
+
filter_id=filter_id,
|
|
1120
|
+
ignore_pagination=ignore_pagination,
|
|
1121
|
+
details=details,
|
|
1122
|
+
)
|
|
1123
|
+
)
|
|
1124
|
+
|
|
1092
1125
|
def get_report_operating_systems(
|
|
1093
1126
|
self,
|
|
1094
1127
|
report_id: EntityID,
|
|
@@ -1642,3 +1675,136 @@ class GMPNext(GMPv227[T]):
|
|
|
1642
1675
|
tasks=tasks,
|
|
1643
1676
|
)
|
|
1644
1677
|
)
|
|
1678
|
+
|
|
1679
|
+
def get_scan_report(
|
|
1680
|
+
self,
|
|
1681
|
+
scan_report_id: EntityID,
|
|
1682
|
+
*,
|
|
1683
|
+
filter_string: str | None = None,
|
|
1684
|
+
filter_id: str | None = None,
|
|
1685
|
+
) -> T:
|
|
1686
|
+
""" "Request a structured summary of a single scan report.
|
|
1687
|
+
|
|
1688
|
+
Args:
|
|
1689
|
+
scan_report_id: UUID of an existing scan report.
|
|
1690
|
+
filter_string: Filter term to apply to the report results.
|
|
1691
|
+
filter_id: UUID of a saved filter to apply to the report results.
|
|
1692
|
+
|
|
1693
|
+
Returns:
|
|
1694
|
+
A request for the get_scan_report GMP command.
|
|
1695
|
+
|
|
1696
|
+
Raises:
|
|
1697
|
+
RequiredArgument: If scan_report_id is not provided.
|
|
1698
|
+
"""
|
|
1699
|
+
return self._send_request_and_transform_response(
|
|
1700
|
+
ScanReports.get_scan_report(
|
|
1701
|
+
scan_report_id=scan_report_id,
|
|
1702
|
+
filter_string=filter_string,
|
|
1703
|
+
filter_id=filter_id,
|
|
1704
|
+
)
|
|
1705
|
+
)
|
|
1706
|
+
|
|
1707
|
+
def get_audit_report( # type: ignore[override]
|
|
1708
|
+
self,
|
|
1709
|
+
audit_report_id: EntityID,
|
|
1710
|
+
*,
|
|
1711
|
+
filter_string: str | None = None,
|
|
1712
|
+
filter_id: str | None = None,
|
|
1713
|
+
) -> T:
|
|
1714
|
+
"""Request a structured summary of a single audit report.
|
|
1715
|
+
|
|
1716
|
+
Args:
|
|
1717
|
+
audit_report_id: UUID of an existing audit report.
|
|
1718
|
+
filter_string: Filter term to apply to the report results.
|
|
1719
|
+
filter_id: UUID of a saved filter to apply to the report results.
|
|
1720
|
+
|
|
1721
|
+
Returns:
|
|
1722
|
+
A request for the get_audit_report GMP command.
|
|
1723
|
+
|
|
1724
|
+
Raises:
|
|
1725
|
+
RequiredArgument: If audit_report_id is not provided.
|
|
1726
|
+
"""
|
|
1727
|
+
return self._send_request_and_transform_response(
|
|
1728
|
+
AuditReport.get_audit_report(
|
|
1729
|
+
audit_report_id=audit_report_id,
|
|
1730
|
+
filter_string=filter_string,
|
|
1731
|
+
filter_id=filter_id,
|
|
1732
|
+
)
|
|
1733
|
+
)
|
|
1734
|
+
|
|
1735
|
+
def get_audit_report_legacy(
|
|
1736
|
+
self,
|
|
1737
|
+
report_id: EntityID,
|
|
1738
|
+
*,
|
|
1739
|
+
filter_string: str | None = None,
|
|
1740
|
+
filter_id: str | None = None,
|
|
1741
|
+
delta_report_id: EntityID | None = None,
|
|
1742
|
+
report_format_id: str | ReportFormatType | None = None,
|
|
1743
|
+
ignore_pagination: bool | None = None,
|
|
1744
|
+
details: bool | None = True,
|
|
1745
|
+
) -> T:
|
|
1746
|
+
"""Request an audit report using the legacy command.
|
|
1747
|
+
|
|
1748
|
+
Deprecated:
|
|
1749
|
+
Use ``get_audit_report`` instead. This method will be removed
|
|
1750
|
+
in the next major release.
|
|
1751
|
+
"""
|
|
1752
|
+
return super().get_audit_report(
|
|
1753
|
+
report_id,
|
|
1754
|
+
filter_string=filter_string,
|
|
1755
|
+
filter_id=filter_id,
|
|
1756
|
+
delta_report_id=delta_report_id,
|
|
1757
|
+
report_format_id=report_format_id,
|
|
1758
|
+
ignore_pagination=ignore_pagination,
|
|
1759
|
+
details=details,
|
|
1760
|
+
)
|
|
1761
|
+
|
|
1762
|
+
def export_scan_report(
|
|
1763
|
+
self,
|
|
1764
|
+
report_id: EntityID,
|
|
1765
|
+
format_id: EntityID,
|
|
1766
|
+
*,
|
|
1767
|
+
config_id: EntityID | None = None,
|
|
1768
|
+
filter_string: str | None = None,
|
|
1769
|
+
ignore_pagination: bool = False,
|
|
1770
|
+
lean: bool = False,
|
|
1771
|
+
notes_details: bool = False,
|
|
1772
|
+
overrides_details: bool = False,
|
|
1773
|
+
result_tags: bool = False,
|
|
1774
|
+
) -> T:
|
|
1775
|
+
"""Request an asynchronous export of a scan report.
|
|
1776
|
+
|
|
1777
|
+
If an identical export is already pending or running, the existing
|
|
1778
|
+
report export is returned instead of creating a duplicate.
|
|
1779
|
+
|
|
1780
|
+
Args:
|
|
1781
|
+
report_id: UUID of the scan report to export.
|
|
1782
|
+
format_id: UUID of the report format to apply.
|
|
1783
|
+
config_id: UUID of an optional report configuration.
|
|
1784
|
+
filter_string: Filter term to apply while generating the report.
|
|
1785
|
+
ignore_pagination: Whether pagination settings in the filter
|
|
1786
|
+
should be ignored.
|
|
1787
|
+
lean: Whether lean report data should be generated.
|
|
1788
|
+
notes_details: Whether note details should be included.
|
|
1789
|
+
overrides_details: Whether override details should be included.
|
|
1790
|
+
result_tags: Whether result tags should be included.
|
|
1791
|
+
|
|
1792
|
+
Returns:
|
|
1793
|
+
A request for the export_scan_report GMP command.
|
|
1794
|
+
|
|
1795
|
+
Raises:
|
|
1796
|
+
RequiredArgument: If report_id or format_id is not provided.
|
|
1797
|
+
"""
|
|
1798
|
+
return self._send_request_and_transform_response(
|
|
1799
|
+
ScanReports.export_scan_report(
|
|
1800
|
+
report_id=report_id,
|
|
1801
|
+
format_id=format_id,
|
|
1802
|
+
config_id=config_id,
|
|
1803
|
+
filter_string=filter_string,
|
|
1804
|
+
ignore_pagination=ignore_pagination,
|
|
1805
|
+
lean=lean,
|
|
1806
|
+
notes_details=notes_details,
|
|
1807
|
+
overrides_details=overrides_details,
|
|
1808
|
+
result_tags=result_tags,
|
|
1809
|
+
)
|
|
1810
|
+
)
|
|
@@ -8,6 +8,7 @@ from gvm.protocols.gmp.requests.next._agent_installer_instructions import (
|
|
|
8
8
|
AgentInstallerInstructions,
|
|
9
9
|
)
|
|
10
10
|
from gvm.protocols.gmp.requests.next._agents import Agents
|
|
11
|
+
from gvm.protocols.gmp.requests.next._audit_report import AuditReport
|
|
11
12
|
from gvm.protocols.gmp.requests.next._credential_stores import CredentialStores
|
|
12
13
|
from gvm.protocols.gmp.requests.next._credentials import (
|
|
13
14
|
Credentials,
|
|
@@ -44,6 +45,7 @@ from gvm.protocols.gmp.requests.next._report_tls_certificates import (
|
|
|
44
45
|
from gvm.protocols.gmp.requests.next._report_vulnerabilities import (
|
|
45
46
|
ReportVulnerabilities,
|
|
46
47
|
)
|
|
48
|
+
from gvm.protocols.gmp.requests.next._scan_report import ScanReports
|
|
47
49
|
from gvm.protocols.gmp.requests.next._targets import AliveTest, Targets
|
|
48
50
|
from gvm.protocols.gmp.requests.next._tasks import Tasks
|
|
49
51
|
from gvm.protocols.gmp.requests.next._web_application_targets import (
|
|
@@ -130,6 +132,7 @@ __all__ = (
|
|
|
130
132
|
"AlertMethod",
|
|
131
133
|
"Alerts",
|
|
132
134
|
"AliveTest",
|
|
135
|
+
"AuditReport",
|
|
133
136
|
"AuditReports",
|
|
134
137
|
"Audits",
|
|
135
138
|
"Authentication",
|
|
@@ -184,6 +187,7 @@ __all__ = (
|
|
|
184
187
|
"Results",
|
|
185
188
|
"Roles",
|
|
186
189
|
"ScanConfigs",
|
|
190
|
+
"ScanReports",
|
|
187
191
|
"ScannerType",
|
|
188
192
|
"Scanners",
|
|
189
193
|
"Schedules",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from gvm.errors import RequiredArgument
|
|
2
|
+
from gvm.protocols.core import Request
|
|
3
|
+
from gvm.protocols.gmp.requests import EntityID
|
|
4
|
+
from gvm.xml import XmlCommand
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AuditReport:
|
|
8
|
+
@classmethod
|
|
9
|
+
def get_audit_report(
|
|
10
|
+
cls,
|
|
11
|
+
audit_report_id: EntityID,
|
|
12
|
+
*,
|
|
13
|
+
filter_string: str | None = None,
|
|
14
|
+
filter_id: str | None = None,
|
|
15
|
+
) -> Request:
|
|
16
|
+
"""Request a structured summary of a single audit report.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
audit_report_id: UUID of an existing audit report.
|
|
20
|
+
filter_string: Filter term to apply to the report results.
|
|
21
|
+
filter_id: UUID of a saved filter to apply to the report results.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
A request for the get_audit_report GMP command.
|
|
25
|
+
|
|
26
|
+
Raises:
|
|
27
|
+
RequiredArgument: If audit_report_id is not provided.
|
|
28
|
+
"""
|
|
29
|
+
if not audit_report_id:
|
|
30
|
+
raise RequiredArgument(
|
|
31
|
+
function=cls.get_audit_report.__name__,
|
|
32
|
+
argument="audit_report_id",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
cmd = XmlCommand("get_audit_report")
|
|
36
|
+
cmd.set_attribute("audit_report_id", str(audit_report_id))
|
|
37
|
+
cmd.add_filter(filter_string, filter_id)
|
|
38
|
+
|
|
39
|
+
return cmd
|
|
@@ -44,3 +44,42 @@ class ReportHosts:
|
|
|
44
44
|
cmd.set_attribute("details", to_bool(details))
|
|
45
45
|
|
|
46
46
|
return cmd
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def get_audit_report_hosts(
|
|
50
|
+
cls,
|
|
51
|
+
report_id: EntityID,
|
|
52
|
+
*,
|
|
53
|
+
filter_string: str | None = None,
|
|
54
|
+
filter_id: str | None = None,
|
|
55
|
+
ignore_pagination: bool | None = None,
|
|
56
|
+
details: bool | None = True,
|
|
57
|
+
) -> Request:
|
|
58
|
+
"""Request hosts of a single audit report.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
report_id: UUID of an existing report.
|
|
62
|
+
filter_string: Filter term to use to filter results in the report
|
|
63
|
+
filter_id: UUID of filter to use to filter results in the report
|
|
64
|
+
ignore_pagination: Whether to ignore the filter terms "first" and
|
|
65
|
+
"rows".
|
|
66
|
+
details: Request additional report host information details.
|
|
67
|
+
Defaults to True.
|
|
68
|
+
"""
|
|
69
|
+
cmd = XmlCommand("get_audit_report_hosts")
|
|
70
|
+
|
|
71
|
+
if not report_id:
|
|
72
|
+
raise RequiredArgument(
|
|
73
|
+
function=cls.get_report_hosts.__name__, argument="report_id"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
cmd.set_attribute("report_id", str(report_id))
|
|
77
|
+
|
|
78
|
+
cmd.add_filter(filter_string, filter_id)
|
|
79
|
+
|
|
80
|
+
if ignore_pagination is not None:
|
|
81
|
+
cmd.set_attribute("ignore_pagination", to_bool(ignore_pagination))
|
|
82
|
+
|
|
83
|
+
cmd.set_attribute("details", to_bool(details))
|
|
84
|
+
|
|
85
|
+
return cmd
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from gvm.errors import RequiredArgument
|
|
2
|
+
from gvm.protocols.core import Request
|
|
3
|
+
from gvm.protocols.gmp.requests import EntityID
|
|
4
|
+
from gvm.utils import to_bool
|
|
5
|
+
from gvm.xml import XmlCommand
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ScanReports:
|
|
9
|
+
@classmethod
|
|
10
|
+
def get_scan_report(
|
|
11
|
+
cls,
|
|
12
|
+
scan_report_id: EntityID,
|
|
13
|
+
*,
|
|
14
|
+
filter_string: str | None = None,
|
|
15
|
+
filter_id: str | None = None,
|
|
16
|
+
) -> Request:
|
|
17
|
+
"""Request a structured summary of a single scan report.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
scan_report_id: UUID of an existing scan report.
|
|
21
|
+
filter_string: Filter term to apply to the report results.
|
|
22
|
+
filter_id: UUID of a saved filter to apply to the report results.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
A request for the get_scan_report GMP command.
|
|
26
|
+
|
|
27
|
+
Raises:
|
|
28
|
+
RequiredArgument: If scan_report_id is not provided.
|
|
29
|
+
"""
|
|
30
|
+
if not scan_report_id:
|
|
31
|
+
raise RequiredArgument(
|
|
32
|
+
function=cls.get_scan_report.__name__,
|
|
33
|
+
argument="scan_report_id",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
cmd = XmlCommand("get_scan_report")
|
|
37
|
+
cmd.set_attribute("scan_report_id", str(scan_report_id))
|
|
38
|
+
cmd.add_filter(filter_string, filter_id)
|
|
39
|
+
|
|
40
|
+
return cmd
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def export_scan_report(
|
|
44
|
+
cls,
|
|
45
|
+
report_id: EntityID,
|
|
46
|
+
format_id: EntityID,
|
|
47
|
+
*,
|
|
48
|
+
config_id: EntityID | None = None,
|
|
49
|
+
filter_string: str | None = None,
|
|
50
|
+
ignore_pagination: bool = False,
|
|
51
|
+
lean: bool = False,
|
|
52
|
+
notes_details: bool = False,
|
|
53
|
+
overrides_details: bool = False,
|
|
54
|
+
result_tags: bool = False,
|
|
55
|
+
) -> Request:
|
|
56
|
+
"""Request an asynchronous export of a scan report.
|
|
57
|
+
|
|
58
|
+
If an identical export is already pending or running, the existing
|
|
59
|
+
report export is returned instead of creating a duplicate.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
report_id: UUID of the scan report to export.
|
|
63
|
+
format_id: UUID of the report format to apply.
|
|
64
|
+
config_id: UUID of an optional report configuration.
|
|
65
|
+
filter_string: Filter term to apply while generating the report.
|
|
66
|
+
ignore_pagination: Whether pagination settings in the filter
|
|
67
|
+
should be ignored.
|
|
68
|
+
lean: Whether lean report data should be generated.
|
|
69
|
+
notes_details: Whether note details should be included.
|
|
70
|
+
overrides_details: Whether override details should be included.
|
|
71
|
+
result_tags: Whether result tags should be included.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
A request for the export_scan_report GMP command.
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
RequiredArgument: If report_id is not provided.
|
|
78
|
+
"""
|
|
79
|
+
if not report_id:
|
|
80
|
+
raise RequiredArgument(
|
|
81
|
+
function=cls.export_scan_report.__name__,
|
|
82
|
+
argument="report_id",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
cmd = XmlCommand("export_scan_report")
|
|
86
|
+
cmd.set_attribute("report_id", str(report_id))
|
|
87
|
+
cmd.set_attribute("format_id", str(format_id))
|
|
88
|
+
|
|
89
|
+
if config_id:
|
|
90
|
+
cmd.set_attribute("config_id", str(config_id))
|
|
91
|
+
|
|
92
|
+
if filter_string is not None:
|
|
93
|
+
cmd.set_attribute("filter", filter_string)
|
|
94
|
+
|
|
95
|
+
cmd.set_attribute(
|
|
96
|
+
"ignore_pagination",
|
|
97
|
+
to_bool(ignore_pagination),
|
|
98
|
+
)
|
|
99
|
+
cmd.set_attribute("lean", to_bool(lean))
|
|
100
|
+
cmd.set_attribute(
|
|
101
|
+
"notes_details",
|
|
102
|
+
to_bool(notes_details),
|
|
103
|
+
)
|
|
104
|
+
cmd.set_attribute(
|
|
105
|
+
"overrides_details",
|
|
106
|
+
to_bool(overrides_details),
|
|
107
|
+
)
|
|
108
|
+
cmd.set_attribute(
|
|
109
|
+
"result_tags",
|
|
110
|
+
to_bool(result_tags),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return cmd
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
|
|
5
5
|
"""
|
|
6
|
-
http client for initializing a connection to the openvasd HTTP API
|
|
6
|
+
http client for initializing a connection to the openvasd HTTP API.
|
|
7
|
+
|
|
8
|
+
HTTPS with mTLS is used by default. Plain HTTP can be enabled explicitly
|
|
9
|
+
with `insecure_http=True`.
|
|
7
10
|
"""
|
|
8
11
|
|
|
9
12
|
import ssl
|
|
@@ -22,11 +25,14 @@ def create_openvasd_http_client(
|
|
|
22
25
|
client_cert_paths: StrOrPathLike
|
|
23
26
|
| tuple[StrOrPathLike, StrOrPathLike]
|
|
24
27
|
| None = None,
|
|
28
|
+
insecure_http: bool = False,
|
|
25
29
|
port: int = 3000,
|
|
26
30
|
) -> Client:
|
|
27
31
|
"""
|
|
28
|
-
Create a `httpx.Client` configured for
|
|
29
|
-
|
|
32
|
+
Create a `httpx.Client` configured for the OpenVASD HTTP API.
|
|
33
|
+
|
|
34
|
+
mTLS is used by default. Set `insecure_http=True` to use plain HTTP.
|
|
35
|
+
In this case, an API key can be used for authorization.
|
|
30
36
|
|
|
31
37
|
Args:
|
|
32
38
|
host_name: Hostname or IP of the OpenVASD server (e.g., "localhost").
|
|
@@ -34,46 +40,54 @@ def create_openvasd_http_client(
|
|
|
34
40
|
server_ca_path: Path to the server's CA certificate (for verifying the server).
|
|
35
41
|
client_cert_paths: Path to the client certificate (str) or a tuple of
|
|
36
42
|
(cert_path, key_path) for mTLS authentication.
|
|
43
|
+
insecure_http: If True, disables SSL verification and uses HTTP instead of HTTPS.
|
|
37
44
|
port: The port to connect to (default: 3000).
|
|
38
45
|
|
|
39
46
|
Behavior:
|
|
40
|
-
- If
|
|
41
|
-
|
|
42
|
-
- If
|
|
43
|
-
|
|
47
|
+
- If `insecure_http=True`, HTTP is used instead of HTTPS.
|
|
48
|
+
An API key can be used for authorization.
|
|
49
|
+
- If `insecure_http=False` (default), HTTPS with mTLS is used.
|
|
50
|
+
Both `server_ca_path` and `client_cert_paths` are required.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
ValueError: If `insecure_http=False` and either
|
|
54
|
+
`server_ca_path` or `client_cert_paths` is missing.
|
|
44
55
|
"""
|
|
45
56
|
headers = {}
|
|
57
|
+
if api_key:
|
|
58
|
+
headers["X-API-KEY"] = api_key
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
if insecure_http:
|
|
61
|
+
return Client(
|
|
62
|
+
base_url=f"http://{host_name}:{port}",
|
|
63
|
+
headers=headers,
|
|
64
|
+
http2=True,
|
|
65
|
+
timeout=10.0,
|
|
53
66
|
)
|
|
54
|
-
if isinstance(client_cert_paths, tuple):
|
|
55
|
-
context.load_cert_chain(
|
|
56
|
-
certfile=client_cert_paths[0], keyfile=client_cert_paths[1]
|
|
57
|
-
)
|
|
58
|
-
else:
|
|
59
|
-
context.load_cert_chain(certfile=client_cert_paths)
|
|
60
|
-
|
|
61
|
-
context.check_hostname = False
|
|
62
|
-
context.verify_mode = ssl.CERT_REQUIRED
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
if not server_ca_path or not client_cert_paths:
|
|
69
|
+
raise ValueError(
|
|
70
|
+
"Both server_ca_path and client_cert_paths must be provided "
|
|
71
|
+
"when insecure_http is False."
|
|
72
|
+
)
|
|
73
|
+
# Prepare mTLS SSL context
|
|
74
|
+
context = ssl.create_default_context(
|
|
75
|
+
ssl.Purpose.SERVER_AUTH, cafile=server_ca_path
|
|
76
|
+
)
|
|
77
|
+
if isinstance(client_cert_paths, tuple):
|
|
78
|
+
context.load_cert_chain(
|
|
79
|
+
certfile=client_cert_paths[0], keyfile=client_cert_paths[1]
|
|
80
|
+
)
|
|
81
|
+
else:
|
|
82
|
+
context.load_cert_chain(certfile=client_cert_paths)
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
context.check_hostname = False
|
|
85
|
+
context.verify_mode = ssl.CERT_REQUIRED
|
|
72
86
|
|
|
73
87
|
return Client(
|
|
74
|
-
base_url=
|
|
88
|
+
base_url=f"https://{host_name}:{port}",
|
|
75
89
|
headers=headers,
|
|
76
|
-
verify=
|
|
90
|
+
verify=context,
|
|
77
91
|
http2=True,
|
|
78
92
|
timeout=10.0,
|
|
79
93
|
)
|
|
@@ -37,6 +37,7 @@ class OpenvasdHttpAPIv1:
|
|
|
37
37
|
client_cert_paths: StrOrPathLike
|
|
38
38
|
| tuple[StrOrPathLike, StrOrPathLike]
|
|
39
39
|
| None = None,
|
|
40
|
+
insecure_http: bool = False,
|
|
40
41
|
suppress_exceptions: bool = False,
|
|
41
42
|
):
|
|
42
43
|
"""
|
|
@@ -48,6 +49,7 @@ class OpenvasdHttpAPIv1:
|
|
|
48
49
|
api_key: Optional API key to be used for authentication.
|
|
49
50
|
server_ca_path: Path to the server CA certificate (for HTTPS/mTLS).
|
|
50
51
|
client_cert_paths: Path to client certificate or (cert, key) tuple for mTLS.
|
|
52
|
+
insecure_http: If True, use HTTP instead of HTTPS and disable certificate verification.
|
|
51
53
|
suppress_exceptions: If True, suppress exceptions and return structured error
|
|
52
54
|
responses. Default is False, which means exceptions will be raised.
|
|
53
55
|
"""
|
|
@@ -57,6 +59,7 @@ class OpenvasdHttpAPIv1:
|
|
|
57
59
|
api_key=api_key,
|
|
58
60
|
server_ca_path=server_ca_path,
|
|
59
61
|
client_cert_paths=client_cert_paths,
|
|
62
|
+
insecure_http=insecure_http,
|
|
60
63
|
)
|
|
61
64
|
|
|
62
65
|
# Sub-API modules
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: python-gvm
|
|
3
|
-
Version: 27.
|
|
3
|
+
Version: 27.7.0
|
|
4
4
|
Summary: Library to communicate with remote servers over GMP or OSP
|
|
5
5
|
Project-URL: Homepage, https://github.com/greenbone/python-gvm/
|
|
6
6
|
Project-URL: Repository, https://github.com/greenbone/python-gvm/
|
|
@@ -22,10 +22,10 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
22
22
|
Requires-Python: <4,>=3.10
|
|
23
23
|
Requires-Dist: httpx[http2]<0.29,>=0.28.1
|
|
24
24
|
Requires-Dist: lxml>=4.5.0
|
|
25
|
-
Requires-Dist: paramiko
|
|
25
|
+
Requires-Dist: paramiko<6,>=5.0.0
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
|
|
28
|
-

|
|
29
29
|
|
|
30
30
|
# Greenbone Vulnerability Management Python Library <!-- omit in toc -->
|
|
31
31
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
gvm/__init__.py,sha256=Eu3a8hRdlixDFn34Q-BwPXVN65KHpgFk_i0CYUdbfF8,412
|
|
2
|
-
gvm/__version__.py,sha256=
|
|
2
|
+
gvm/__version__.py,sha256=4TQ-2iqDj-a7CEfg_6neCIN7PJ6wsiqaJaZGgEq46OA,103
|
|
3
3
|
gvm/_enum.py,sha256=n--ztwQQW2MU4M9E_4qJrw-32IGc4Laj6auZ8glMw_0,1168
|
|
4
4
|
gvm/errors.py,sha256=FnZoe3ROKlAm8LMJ25uKRaG9cp-SG8hYIVtDMwwp0l0,5263
|
|
5
5
|
gvm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -27,14 +27,15 @@ gvm/protocols/gmp/_gmp224.py,sha256=NO-ufzkGW1RNzMHrIjlFm7r8QzSH0uRZK5xc9mWLRVI,
|
|
|
27
27
|
gvm/protocols/gmp/_gmp225.py,sha256=3lz_AHTIQdBEr4DIYJ5o9D0Eke-Df3jUb0IZytITRdo,2227
|
|
28
28
|
gvm/protocols/gmp/_gmp226.py,sha256=YqQ7CJIbUtM7s8wQPYX5BgePdhX-tUjCemanW0_DZtE,14543
|
|
29
29
|
gvm/protocols/gmp/_gmp227.py,sha256=-q4Aci1I4FRtLle21qTwtkchE2ixWn1-Kug58X4dU5I,5713
|
|
30
|
-
gvm/protocols/gmp/_gmpnext.py,sha256
|
|
30
|
+
gvm/protocols/gmp/_gmpnext.py,sha256=-hZUiOZf0fd6DElCG97Bq0IkzmzThNl1EHRkWzDw_mE,64464
|
|
31
31
|
gvm/protocols/gmp/requests/__init__.py,sha256=XH1zSifyz9Rx4FqY2lJ1mwurnUepHk7REZ-fSMC_Wx0,200
|
|
32
32
|
gvm/protocols/gmp/requests/_entity_id.py,sha256=V96VhTg7_CF2AduaAHRYrGgTaOVA8_mG1lFiCl8-CMA,136
|
|
33
33
|
gvm/protocols/gmp/requests/_version.py,sha256=GdHQnEVzJ6PbxoU4pxP36Oze1XvK5llWqB9bkC16Pf8,393
|
|
34
|
-
gvm/protocols/gmp/requests/next/__init__.py,sha256=
|
|
34
|
+
gvm/protocols/gmp/requests/next/__init__.py,sha256=o_LZf7Rd4kY5OMwIo39S4btQfi8Z9rN39L09QXnVfG0,4822
|
|
35
35
|
gvm/protocols/gmp/requests/next/_agent_groups.py,sha256=Dqa77vY2U82lG6wkLZfGMIUOHfZW9yCXkFvT3M8bFfo,6275
|
|
36
36
|
gvm/protocols/gmp/requests/next/_agent_installer_instructions.py,sha256=wh4LBJVEE3t_Og9uf5Ek_y8MxjtnTcBa2IT4u4JVXg0,1798
|
|
37
37
|
gvm/protocols/gmp/requests/next/_agents.py,sha256=j4UNQmfeH8ToFfA8T4JiPKb4ZGpQy71DL--sbaVXttM,15589
|
|
38
|
+
gvm/protocols/gmp/requests/next/_audit_report.py,sha256=ssCzIQXSRFFjLAYGtlJoMDZSPAF9q_JLJs1IBsxHZ2c,1209
|
|
38
39
|
gvm/protocols/gmp/requests/next/_credential_stores.py,sha256=wgixeHhls_Nvd7lYPE3mra_2vtWFZscm8HCwy4UgUNg,5691
|
|
39
40
|
gvm/protocols/gmp/requests/next/_credentials.py,sha256=9iI2F4rp6TtQdM-OXS9IKN09SZRRLxYeBMcZs-Heo1Q,6107
|
|
40
41
|
gvm/protocols/gmp/requests/next/_integration_configs.py,sha256=j9RospMEU9ErjUzRNHv9tvv0_yRSwMfJdOKNUmJC4rk,3715
|
|
@@ -43,11 +44,12 @@ gvm/protocols/gmp/requests/next/_report_applications.py,sha256=EVqMMb1u-uQatywFu
|
|
|
43
44
|
gvm/protocols/gmp/requests/next/_report_closed_cves.py,sha256=2j2ZFScgQughuGmbW5eaagdgPlOnYr38JnQ3ruEpLUQ,1244
|
|
44
45
|
gvm/protocols/gmp/requests/next/_report_cves.py,sha256=VZa25Tkiabg19tNkxVsxz1_oDz2ERGyL5LCQwuHtY_Y,1471
|
|
45
46
|
gvm/protocols/gmp/requests/next/_report_errors.py,sha256=tB3zvDSaV0e3HjteK__oOFQwce5Tjbv5KQgM4eBEbJk,1483
|
|
46
|
-
gvm/protocols/gmp/requests/next/_report_hosts.py,sha256=
|
|
47
|
+
gvm/protocols/gmp/requests/next/_report_hosts.py,sha256=qYyPwr4QBuC8CYt_COaZYDNIFyT74rPX9Ik6DjG-Owg,2764
|
|
47
48
|
gvm/protocols/gmp/requests/next/_report_operating_systems.py,sha256=qN6-94OYKXGQQZ4q7RuRLtoaBduT500ocYb_-mIW5E0,1566
|
|
48
49
|
gvm/protocols/gmp/requests/next/_report_ports.py,sha256=xTzdBFKqYHv1ulH1BduWEE-wO3SzuMu0yU7pnB5jx5E,1477
|
|
49
50
|
gvm/protocols/gmp/requests/next/_report_tls_certificates.py,sha256=-h1d3OVn873DLEHHvjeLVpOpvErJo5C3u5tyxIrXUI8,1559
|
|
50
51
|
gvm/protocols/gmp/requests/next/_report_vulnerabilities.py,sha256=8TOQm-CyaHtTOL1dXDUrFYEzuohdeSs_TeonCeVJJzg,1543
|
|
52
|
+
gvm/protocols/gmp/requests/next/_scan_report.py,sha256=uJTnoBxSGGRjFyI0v0AOTCDkgs0VEBoWwdoDdBO6Deo,3662
|
|
51
53
|
gvm/protocols/gmp/requests/next/_targets.py,sha256=EIiYyPNrzflxjr3pmY0ZT25KSHn-ISERD3IfrzVauZI,12707
|
|
52
54
|
gvm/protocols/gmp/requests/next/_tasks.py,sha256=4faG2a3wey9-fj-el4TiAwBUbu4H8M7EZ9WyO3SJ0QM,27016
|
|
53
55
|
gvm/protocols/gmp/requests/next/_web_application_targets.py,sha256=03EYFVXKmVf0ZS_CTaXGsD-ALclSu9Hc2hm6p0LLV8o,6563
|
|
@@ -106,14 +108,14 @@ gvm/protocols/gmp/requests/v227/_scanners.py,sha256=-hxjO2gHZE2J2rNH51wJRAfVzbPY
|
|
|
106
108
|
gvm/protocols/http/__init__.py,sha256=HnS3bXYZiYzU0E167TWDX5Egd9aCetsCrFTojVFIrd4,239
|
|
107
109
|
gvm/protocols/http/openvasd/__init__.py,sha256=7AVS1dhfl5JsrnMyI9l7uVPSKEGsQq8dNAwfHGcucUk,392
|
|
108
110
|
gvm/protocols/http/openvasd/_api.py,sha256=3p_DxXtWJNzN5yw2mxRCsDqaECVyftYO4mZAWaj3mNA,696
|
|
109
|
-
gvm/protocols/http/openvasd/_client.py,sha256=
|
|
111
|
+
gvm/protocols/http/openvasd/_client.py,sha256=ZMItdYHG0jmJUSsygqmfaK44W-bpGnFKQ33puuuSsRU,2924
|
|
110
112
|
gvm/protocols/http/openvasd/_health.py,sha256=lHXyBs4i1He7jogvnn9y8-ElGmiHyU3SyCFUUC0Dlmc,2607
|
|
111
113
|
gvm/protocols/http/openvasd/_metadata.py,sha256=W3TQeeNN-X-5vZ89WvsxwEym8EjQmOFPcBsya_bd3F8,3302
|
|
112
114
|
gvm/protocols/http/openvasd/_notus.py,sha256=FwX5fFsx-FWXf4Rl_5seequkQ6XVS8jZ0NWb_5Lsk2s,1907
|
|
113
|
-
gvm/protocols/http/openvasd/_openvasd1.py,sha256=
|
|
115
|
+
gvm/protocols/http/openvasd/_openvasd1.py,sha256=VS-fErATsT25SJxk0UVQRFETJ5OtGnrhk8aNsFqs7Ew,4074
|
|
114
116
|
gvm/protocols/http/openvasd/_scans.py,sha256=U8aYmHudMQFtVzl9khjNsRRewY0sf8G376zTYZN6HQQ,16667
|
|
115
117
|
gvm/protocols/http/openvasd/_vts.py,sha256=_T4j4SdXe0DthBA7pCehx4FXKYbQyhzpq72YNO4fKt4,2136
|
|
116
|
-
python_gvm-27.
|
|
117
|
-
python_gvm-27.
|
|
118
|
-
python_gvm-27.
|
|
119
|
-
python_gvm-27.
|
|
118
|
+
python_gvm-27.7.0.dist-info/METADATA,sha256=4DiJ-kw4PfsYTZToseS8ZgpbN7JMep_F7HNQmxN4J6A,5699
|
|
119
|
+
python_gvm-27.7.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
120
|
+
python_gvm-27.7.0.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
121
|
+
python_gvm-27.7.0.dist-info/RECORD,,
|
|
File without changes
|