Skip to content

Commit 9f5fe5c

Browse files
committed
add argument scan_config_id for get_report to get customizable reports
added the option to use the config id with get_report to get customizable reports
1 parent acbfce4 commit 9f5fe5c

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

gvm/protocols/gmp/_gmp224.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,6 +2907,7 @@ def get_report(
29072907
filter_id: Optional[str] = None,
29082908
delta_report_id: Optional[EntityID] = None,
29092909
report_format_id: Optional[Union[str, ReportFormatType]] = None,
2910+
report_config_id: Optional[str] = None,
29102911
ignore_pagination: Optional[bool] = None,
29112912
details: Optional[bool] = True,
29122913
) -> T:
@@ -2919,6 +2920,7 @@ def get_report(
29192920
delta_report_id: UUID of an existing report to compare report to.
29202921
report_format_id: UUID of report format to use
29212922
or ReportFormatType (enum)
2923+
report_config_id: UUID of report format config to use
29222924
ignore_pagination: Whether to ignore the filter terms "first" and
29232925
"rows".
29242926
details: Request additional report information details
@@ -2931,6 +2933,7 @@ def get_report(
29312933
filter_id=filter_id,
29322934
delta_report_id=delta_report_id,
29332935
report_format_id=report_format_id,
2936+
report_config_id=report_config_id,
29342937
ignore_pagination=ignore_pagination,
29352938
details=details,
29362939
)

gvm/protocols/gmp/_gmp226.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def get_report(
103103
filter_id: Optional[str] = None,
104104
delta_report_id: Optional[EntityID] = None,
105105
report_format_id: Optional[Union[str, ReportFormatType]] = None,
106+
report_config_id: Optional[str] = None,
106107
ignore_pagination: Optional[bool] = None,
107108
details: Optional[bool] = True,
108109
) -> T:
@@ -115,6 +116,7 @@ def get_report(
115116
delta_report_id: UUID of an existing report to compare report to.
116117
report_format_id: UUID of report format to use
117118
or ReportFormatType (enum)
119+
report_config_id: UUID of report format config to use
118120
ignore_pagination: Whether to ignore the filter terms "first" and
119121
"rows".
120122
details: Request additional report information details
@@ -127,6 +129,7 @@ def get_report(
127129
filter_id=filter_id,
128130
delta_report_id=delta_report_id,
129131
report_format_id=report_format_id,
132+
report_config_id=report_config_id,
130133
ignore_pagination=ignore_pagination,
131134
details=details,
132135
)

gvm/protocols/gmp/requests/v224/_reports.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def get_report(
4141
filter_id: Optional[str] = None,
4242
delta_report_id: Optional[EntityID] = None,
4343
report_format_id: Optional[Union[str, ReportFormatType]] = None,
44+
report_config_id: Optional[str] = None,
4445
ignore_pagination: Optional[bool] = None,
4546
details: Optional[bool] = True,
4647
) -> Request:
@@ -53,6 +54,7 @@ def get_report(
5354
delta_report_id: UUID of an existing report to compare report to.
5455
report_format_id: UUID of report format to use
5556
or ReportFormatType (enum)
57+
report_config_id: UUID of report format config to use
5658
ignore_pagination: Whether to ignore the filter terms "first" and
5759
"rows".
5860
details: Request additional report information details
@@ -75,6 +77,9 @@ def get_report(
7577
if report_format_id:
7678
cmd.set_attribute("format_id", str(report_format_id))
7779

80+
if report_config_id:
81+
cmd.set_attribute("config_id", str(report_config_id))
82+
7883
if ignore_pagination is not None:
7984
cmd.set_attribute("ignore_pagination", to_bool(ignore_pagination))
8085

gvm/protocols/gmp/requests/v226/_reports.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def get_report(
4141
filter_id: Optional[str] = None,
4242
delta_report_id: Optional[EntityID] = None,
4343
report_format_id: Optional[Union[str, ReportFormatType]] = None,
44+
report_config_id: Optional[str] = None,
4445
ignore_pagination: Optional[bool] = None,
4546
details: Optional[bool] = True,
4647
) -> Request:
@@ -53,6 +54,7 @@ def get_report(
5354
delta_report_id: UUID of an existing report to compare report to.
5455
report_format_id: UUID of report format to use
5556
or ReportFormatType (enum)
57+
report_config_id: UUID of report format config to use
5658
ignore_pagination: Whether to ignore the filter terms "first" and
5759
"rows".
5860
details: Request additional report information details
@@ -76,6 +78,9 @@ def get_report(
7678
if report_format_id:
7779
cmd.set_attribute("format_id", str(report_format_id))
7880

81+
if report_config_id:
82+
cmd.set_attribute("config_id", str(report_config_id))
83+
7984
if ignore_pagination is not None:
8085
cmd.set_attribute("ignore_pagination", to_bool(ignore_pagination))
8186

tests/protocols/gmpv226/entities/reports/test_get_report.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ def test_get_report_with_report_format_id(self):
3636
b'<get_reports report_id="r1" usage_type="scan" format_id="bar" details="1"/>'
3737
)
3838

39+
def test_get_report_with_report_format_id_and_config_id(self):
40+
self.gmp.get_report(
41+
report_id="r1", report_format_id="bar", report_config_id="c1"
42+
)
43+
44+
self.connection.send.has_been_called_with(
45+
b'<get_reports report_id="r1" usage_type="scan" format_id="bar" config_id="c1" details="1"/>'
46+
)
47+
3948
def test_get_report_with_report_format_type(self):
4049
self.gmp.get_report(
4150
report_id="r1", report_format_id=ReportFormatType.TXT

0 commit comments

Comments
 (0)