python-gvm 27.1.0__py3-none-any.whl → 27.3.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 +418 -37
- gvm/protocols/gmp/requests/next/__init__.py +15 -4
- gvm/protocols/gmp/requests/next/_agent_groups.py +17 -1
- gvm/protocols/gmp/requests/next/_agent_installer_instructions.py +43 -0
- gvm/protocols/gmp/requests/next/_report_vulnerabilities.py +47 -0
- gvm/protocols/gmp/requests/next/_targets.py +373 -0
- gvm/protocols/gmp/requests/next/_tasks.py +122 -0
- gvm/protocols/gmp/requests/next/_web_application_targets.py +209 -0
- {python_gvm-27.1.0.dist-info → python_gvm-27.3.0.dist-info}/METADATA +1 -1
- {python_gvm-27.1.0.dist-info → python_gvm-27.3.0.dist-info}/RECORD +13 -10
- {python_gvm-27.1.0.dist-info → python_gvm-27.3.0.dist-info}/WHEEL +1 -1
- gvm/protocols/gmp/requests/next/_agent_installers.py +0 -81
- {python_gvm-27.1.0.dist-info → python_gvm-27.3.0.dist-info}/licenses/LICENSE +0 -0
gvm/__version__.py
CHANGED
gvm/protocols/gmp/_gmpnext.py
CHANGED
|
@@ -12,8 +12,10 @@ from .._protocol import T
|
|
|
12
12
|
from ._gmp227 import GMPv227
|
|
13
13
|
from .requests.next import (
|
|
14
14
|
AgentGroups,
|
|
15
|
-
|
|
15
|
+
AgentInstallerInstructionLanguageType,
|
|
16
|
+
AgentInstallerInstructions,
|
|
16
17
|
Agents,
|
|
18
|
+
AliveTest,
|
|
17
19
|
Credentials,
|
|
18
20
|
CredentialStoreCredentialType,
|
|
19
21
|
CredentialStores,
|
|
@@ -27,8 +29,12 @@ from .requests.next import (
|
|
|
27
29
|
ReportOperatingSystems,
|
|
28
30
|
ReportPorts,
|
|
29
31
|
ReportTlsCertificates,
|
|
32
|
+
ReportVulnerabilities,
|
|
33
|
+
Targets,
|
|
30
34
|
Tasks,
|
|
35
|
+
WebApplicationTargets,
|
|
31
36
|
)
|
|
37
|
+
from .requests.v224 import AliveTest as AliveTestV224
|
|
32
38
|
from .requests.v224 import HostsOrdering
|
|
33
39
|
|
|
34
40
|
|
|
@@ -54,52 +60,25 @@ class GMPNext(GMPv227[T]):
|
|
|
54
60
|
def get_protocol_version() -> tuple[int, int]:
|
|
55
61
|
return (22, 8)
|
|
56
62
|
|
|
57
|
-
def
|
|
63
|
+
def get_agent_installer_instruction(
|
|
58
64
|
self,
|
|
59
65
|
*,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
trash: bool | None = None,
|
|
63
|
-
details: bool | None = None,
|
|
66
|
+
scanner_id: EntityID,
|
|
67
|
+
language_type: AgentInstallerInstructionLanguageType,
|
|
64
68
|
) -> T:
|
|
65
|
-
"""Request
|
|
69
|
+
"""Request an agent installer instruction.
|
|
66
70
|
|
|
67
71
|
Args:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
trash: Whether to get the trashcan agent installers instead
|
|
71
|
-
details: Whether to include extra details like tasks using this
|
|
72
|
-
scanner
|
|
72
|
+
scanner_id: UUID of the Agent controller to get the installer instruction for.
|
|
73
|
+
language_type: Language of the installer instruction.
|
|
73
74
|
"""
|
|
74
75
|
return self._send_request_and_transform_response(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
trash=trash,
|
|
79
|
-
details=details,
|
|
76
|
+
AgentInstallerInstructions.get_agent_installer_instruction(
|
|
77
|
+
scanner_id=scanner_id,
|
|
78
|
+
language_type=language_type,
|
|
80
79
|
)
|
|
81
80
|
)
|
|
82
81
|
|
|
83
|
-
def get_agent_installer(self, agent_installer_id: EntityID) -> T:
|
|
84
|
-
"""Request a single agent installer
|
|
85
|
-
|
|
86
|
-
Args:
|
|
87
|
-
agent_installer_id: UUID of an existing agent installer
|
|
88
|
-
"""
|
|
89
|
-
return self._send_request_and_transform_response(
|
|
90
|
-
AgentInstallers.get_agent_installer(agent_installer_id)
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
def get_agent_installer_file(self, agent_installer_id: EntityID) -> T:
|
|
94
|
-
"""Request a single agent installer file
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
agent_installer_id: UUID of an existing agent installer
|
|
98
|
-
"""
|
|
99
|
-
return self._send_request_and_transform_response(
|
|
100
|
-
AgentInstallers.get_agent_installer_file(agent_installer_id)
|
|
101
|
-
)
|
|
102
|
-
|
|
103
82
|
def get_agents(
|
|
104
83
|
self,
|
|
105
84
|
*,
|
|
@@ -227,6 +206,7 @@ class GMPNext(GMPv227[T]):
|
|
|
227
206
|
self,
|
|
228
207
|
name: str,
|
|
229
208
|
agent_ids: list[str],
|
|
209
|
+
scheduler_cron_time: str,
|
|
230
210
|
*,
|
|
231
211
|
comment: str | None = None,
|
|
232
212
|
) -> T:
|
|
@@ -235,6 +215,7 @@ class GMPNext(GMPv227[T]):
|
|
|
235
215
|
Args:
|
|
236
216
|
name: Name of the new agent group.
|
|
237
217
|
agent_ids: List of agent UUIDs to include in the group (required).
|
|
218
|
+
scheduler_cron_time: Scheduler cron to use.
|
|
238
219
|
comment: Optional comment for the group.
|
|
239
220
|
|
|
240
221
|
Raises:
|
|
@@ -245,12 +226,14 @@ class GMPNext(GMPv227[T]):
|
|
|
245
226
|
name=name,
|
|
246
227
|
comment=comment,
|
|
247
228
|
agent_ids=agent_ids,
|
|
229
|
+
scheduler_cron_time=scheduler_cron_time,
|
|
248
230
|
)
|
|
249
231
|
)
|
|
250
232
|
|
|
251
233
|
def modify_agent_group(
|
|
252
234
|
self,
|
|
253
235
|
agent_group_id: EntityID,
|
|
236
|
+
scheduler_cron_time: str,
|
|
254
237
|
*,
|
|
255
238
|
name: str | None = None,
|
|
256
239
|
comment: str | None = None,
|
|
@@ -261,6 +244,7 @@ class GMPNext(GMPv227[T]):
|
|
|
261
244
|
Args:
|
|
262
245
|
agent_group_id: UUID of the group to modify.
|
|
263
246
|
name: Optional new name for the group.
|
|
247
|
+
scheduler_cron_time: Scheduler cron to use.
|
|
264
248
|
comment: Optional comment for the group.
|
|
265
249
|
agent_ids: Optional list of agent UUIDs to set for the group.
|
|
266
250
|
|
|
@@ -273,6 +257,7 @@ class GMPNext(GMPv227[T]):
|
|
|
273
257
|
name=name,
|
|
274
258
|
comment=comment,
|
|
275
259
|
agent_ids=agent_ids,
|
|
260
|
+
scheduler_cron_time=scheduler_cron_time,
|
|
276
261
|
)
|
|
277
262
|
)
|
|
278
263
|
|
|
@@ -724,6 +709,49 @@ class GMPNext(GMPv227[T]):
|
|
|
724
709
|
Tasks.create_container_task(name=name, comment=comment)
|
|
725
710
|
)
|
|
726
711
|
|
|
712
|
+
def create_web_application_task(
|
|
713
|
+
self,
|
|
714
|
+
name: str,
|
|
715
|
+
web_application_target_id: EntityID,
|
|
716
|
+
scanner_id: EntityID,
|
|
717
|
+
*,
|
|
718
|
+
comment: str | None = None,
|
|
719
|
+
alterable: bool | None = None,
|
|
720
|
+
schedule_id: EntityID | None = None,
|
|
721
|
+
alert_ids: Sequence[EntityID] | None = None,
|
|
722
|
+
schedule_periods: int | None = None,
|
|
723
|
+
observers: Sequence[str] | None = None,
|
|
724
|
+
preferences: Mapping[str, SupportsStr] | None = None,
|
|
725
|
+
) -> T:
|
|
726
|
+
"""Create a new scan task using a web application target.
|
|
727
|
+
|
|
728
|
+
Args:
|
|
729
|
+
name: Name of the new task.
|
|
730
|
+
web_application_target_id: UUID of the web application target to be scanned.
|
|
731
|
+
scanner_id: UUID of scanner to use for scanning the agents.
|
|
732
|
+
comment: Optional comment for the task.
|
|
733
|
+
alterable: Whether the task should be alterable.
|
|
734
|
+
alert_ids: List of UUIDs for alerts to be applied to the task.
|
|
735
|
+
schedule_id: UUID of a schedule when the task should be run.
|
|
736
|
+
schedule_periods: Limit to number of scheduled runs, 0 for unlimited.
|
|
737
|
+
observers: List of usernames or IDs allowed to observe the task.
|
|
738
|
+
preferences: Scanner preferences as name/value pairs.
|
|
739
|
+
"""
|
|
740
|
+
return self._send_request_and_transform_response(
|
|
741
|
+
Tasks.create_web_application_task(
|
|
742
|
+
name=name,
|
|
743
|
+
web_application_target_id=web_application_target_id,
|
|
744
|
+
scanner_id=scanner_id,
|
|
745
|
+
comment=comment,
|
|
746
|
+
alterable=alterable,
|
|
747
|
+
schedule_id=schedule_id,
|
|
748
|
+
alert_ids=alert_ids,
|
|
749
|
+
schedule_periods=schedule_periods,
|
|
750
|
+
observers=observers,
|
|
751
|
+
preferences=preferences,
|
|
752
|
+
)
|
|
753
|
+
)
|
|
754
|
+
|
|
727
755
|
def create_task(
|
|
728
756
|
self,
|
|
729
757
|
name: str,
|
|
@@ -841,6 +869,7 @@ class GMPNext(GMPv227[T]):
|
|
|
841
869
|
scanner_id: EntityID | None = None,
|
|
842
870
|
agent_group_id: EntityID | None = None,
|
|
843
871
|
oci_image_target_id: EntityID | None = None,
|
|
872
|
+
web_application_target_id: EntityID | None = None,
|
|
844
873
|
alterable: bool | None = None,
|
|
845
874
|
hosts_ordering: HostsOrdering | None = None,
|
|
846
875
|
schedule_id: EntityID | None = None,
|
|
@@ -860,6 +889,7 @@ class GMPNext(GMPv227[T]):
|
|
|
860
889
|
scanner_id: UUID of scanner to use for scanning the target
|
|
861
890
|
agent_group_id: UUID of agent group to use for scanning
|
|
862
891
|
oci_image_target_id: UUID of the OCI Image target to be scanned.
|
|
892
|
+
web_application_target_id: UUID of the web application target to be scanned.
|
|
863
893
|
comment: The comment on the task.
|
|
864
894
|
alert_ids: List of UUIDs for alerts to be applied to the task
|
|
865
895
|
hosts_ordering: The order hosts are scanned in
|
|
@@ -879,6 +909,7 @@ class GMPNext(GMPv227[T]):
|
|
|
879
909
|
scanner_id=scanner_id,
|
|
880
910
|
agent_group_id=agent_group_id,
|
|
881
911
|
oci_image_target_id=oci_image_target_id,
|
|
912
|
+
web_application_target_id=web_application_target_id,
|
|
882
913
|
alterable=alterable,
|
|
883
914
|
hosts_ordering=hosts_ordering,
|
|
884
915
|
schedule_id=schedule_id,
|
|
@@ -1234,3 +1265,353 @@ class GMPNext(GMPv227[T]):
|
|
|
1234
1265
|
details=details,
|
|
1235
1266
|
)
|
|
1236
1267
|
)
|
|
1268
|
+
|
|
1269
|
+
def get_report_vulnerabilities(
|
|
1270
|
+
self,
|
|
1271
|
+
report_id: EntityID,
|
|
1272
|
+
*,
|
|
1273
|
+
filter_string: str | None = None,
|
|
1274
|
+
filter_id: str | None = None,
|
|
1275
|
+
ignore_pagination: bool | None = None,
|
|
1276
|
+
details: bool | None = True,
|
|
1277
|
+
) -> T:
|
|
1278
|
+
"""Request vulnerabilities of a single report.
|
|
1279
|
+
|
|
1280
|
+
Args:
|
|
1281
|
+
report_id: UUID of an existing report.
|
|
1282
|
+
filter_string: Filter term to use to filter results in the report
|
|
1283
|
+
filter_id: UUID of filter to use to filter results in the report
|
|
1284
|
+
ignore_pagination: Whether to ignore the filter terms "first" and
|
|
1285
|
+
"rows".
|
|
1286
|
+
details: Request additional report vulnerability information details.
|
|
1287
|
+
Defaults to True.
|
|
1288
|
+
"""
|
|
1289
|
+
return self._send_request_and_transform_response(
|
|
1290
|
+
ReportVulnerabilities.get_report_vulnerabilities(
|
|
1291
|
+
report_id=report_id,
|
|
1292
|
+
filter_string=filter_string,
|
|
1293
|
+
filter_id=filter_id,
|
|
1294
|
+
ignore_pagination=ignore_pagination,
|
|
1295
|
+
details=details,
|
|
1296
|
+
)
|
|
1297
|
+
)
|
|
1298
|
+
|
|
1299
|
+
def create_web_application_target(
|
|
1300
|
+
self,
|
|
1301
|
+
name: str,
|
|
1302
|
+
urls: list[str],
|
|
1303
|
+
*,
|
|
1304
|
+
comment: str | None = None,
|
|
1305
|
+
exclude_urls: list[str] | None = None,
|
|
1306
|
+
credential_id: EntityID | None = None,
|
|
1307
|
+
) -> T:
|
|
1308
|
+
"""Create a new web application target.
|
|
1309
|
+
|
|
1310
|
+
Args:
|
|
1311
|
+
name: Name of the web application target.
|
|
1312
|
+
urls: List of URLs to scan.
|
|
1313
|
+
comment: Comment for the target.
|
|
1314
|
+
exclude_urls: List of URLs to exclude from the scan.
|
|
1315
|
+
credential_id: UUID of a credential to use on target.
|
|
1316
|
+
"""
|
|
1317
|
+
return self._send_request_and_transform_response(
|
|
1318
|
+
WebApplicationTargets.create_web_application_target(
|
|
1319
|
+
name=name,
|
|
1320
|
+
urls=urls,
|
|
1321
|
+
comment=comment,
|
|
1322
|
+
exclude_urls=exclude_urls,
|
|
1323
|
+
credential_id=credential_id,
|
|
1324
|
+
)
|
|
1325
|
+
)
|
|
1326
|
+
|
|
1327
|
+
def modify_web_application_target(
|
|
1328
|
+
self,
|
|
1329
|
+
web_application_target_id: EntityID,
|
|
1330
|
+
*,
|
|
1331
|
+
name: str | None = None,
|
|
1332
|
+
comment: str | None = None,
|
|
1333
|
+
urls: list[str] | None = None,
|
|
1334
|
+
exclude_urls: list[str] | None = None,
|
|
1335
|
+
credential_id: EntityID | None = None,
|
|
1336
|
+
) -> T:
|
|
1337
|
+
"""Modify an existing web application target.
|
|
1338
|
+
|
|
1339
|
+
Args:
|
|
1340
|
+
web_application_target_id: UUID of target to modify.
|
|
1341
|
+
name: Name of target.
|
|
1342
|
+
comment: Comment on target.
|
|
1343
|
+
urls: List of URLs to scan.
|
|
1344
|
+
exclude_urls: List of URLs to exclude from the scan.
|
|
1345
|
+
credential_id: UUID of credential to use on target.
|
|
1346
|
+
"""
|
|
1347
|
+
return self._send_request_and_transform_response(
|
|
1348
|
+
WebApplicationTargets.modify_web_application_target(
|
|
1349
|
+
web_application_target_id,
|
|
1350
|
+
name=name,
|
|
1351
|
+
comment=comment,
|
|
1352
|
+
urls=urls,
|
|
1353
|
+
exclude_urls=exclude_urls,
|
|
1354
|
+
credential_id=credential_id,
|
|
1355
|
+
)
|
|
1356
|
+
)
|
|
1357
|
+
|
|
1358
|
+
def clone_web_application_target(
|
|
1359
|
+
self, web_application_target_id: EntityID
|
|
1360
|
+
) -> T:
|
|
1361
|
+
"""Clone an existing web application target.
|
|
1362
|
+
|
|
1363
|
+
Args:
|
|
1364
|
+
web_application_target_id: UUID of an existing web application target to clone.
|
|
1365
|
+
"""
|
|
1366
|
+
return self._send_request_and_transform_response(
|
|
1367
|
+
WebApplicationTargets.clone_web_application_target(
|
|
1368
|
+
web_application_target_id
|
|
1369
|
+
)
|
|
1370
|
+
)
|
|
1371
|
+
|
|
1372
|
+
def delete_web_application_target(
|
|
1373
|
+
self,
|
|
1374
|
+
web_application_target_id: EntityID,
|
|
1375
|
+
*,
|
|
1376
|
+
ultimate: bool | None = False,
|
|
1377
|
+
) -> T:
|
|
1378
|
+
"""Delete an existing web application target.
|
|
1379
|
+
|
|
1380
|
+
Args:
|
|
1381
|
+
web_application_target_id: UUID of an existing web application target to delete.
|
|
1382
|
+
ultimate: Whether to remove entirely or to the trashcan.
|
|
1383
|
+
"""
|
|
1384
|
+
return self._send_request_and_transform_response(
|
|
1385
|
+
WebApplicationTargets.delete_web_application_target(
|
|
1386
|
+
web_application_target_id,
|
|
1387
|
+
ultimate=ultimate,
|
|
1388
|
+
)
|
|
1389
|
+
)
|
|
1390
|
+
|
|
1391
|
+
def get_web_application_target(
|
|
1392
|
+
self,
|
|
1393
|
+
web_application_target_id: EntityID,
|
|
1394
|
+
*,
|
|
1395
|
+
tasks: bool | None = None,
|
|
1396
|
+
) -> T:
|
|
1397
|
+
"""Request a single web application target.
|
|
1398
|
+
|
|
1399
|
+
Args:
|
|
1400
|
+
web_application_target_id: UUID of the web application target to request.
|
|
1401
|
+
tasks: Whether to include list of tasks that use the target.
|
|
1402
|
+
"""
|
|
1403
|
+
return self._send_request_and_transform_response(
|
|
1404
|
+
WebApplicationTargets.get_web_application_target(
|
|
1405
|
+
web_application_target_id,
|
|
1406
|
+
tasks=tasks,
|
|
1407
|
+
)
|
|
1408
|
+
)
|
|
1409
|
+
|
|
1410
|
+
def get_web_application_targets(
|
|
1411
|
+
self,
|
|
1412
|
+
*,
|
|
1413
|
+
filter_string: str | None = None,
|
|
1414
|
+
filter_id: EntityID | None = None,
|
|
1415
|
+
trash: bool | None = None,
|
|
1416
|
+
tasks: bool | None = None,
|
|
1417
|
+
) -> T:
|
|
1418
|
+
"""Request a list of web application targets.
|
|
1419
|
+
|
|
1420
|
+
Args:
|
|
1421
|
+
filter_string: Filter term to use for the query.
|
|
1422
|
+
filter_id: UUID of an existing filter to use for the query.
|
|
1423
|
+
trash: Whether to include targets in the trashcan.
|
|
1424
|
+
tasks: Whether to include list of tasks that use the target.
|
|
1425
|
+
"""
|
|
1426
|
+
return self._send_request_and_transform_response(
|
|
1427
|
+
WebApplicationTargets.get_web_application_targets(
|
|
1428
|
+
filter_string=filter_string,
|
|
1429
|
+
filter_id=filter_id,
|
|
1430
|
+
trash=trash,
|
|
1431
|
+
tasks=tasks,
|
|
1432
|
+
)
|
|
1433
|
+
)
|
|
1434
|
+
|
|
1435
|
+
def create_target(
|
|
1436
|
+
self,
|
|
1437
|
+
name: str,
|
|
1438
|
+
*,
|
|
1439
|
+
asset_hosts_filter: str | None = None,
|
|
1440
|
+
hosts: list[str] | None = None,
|
|
1441
|
+
comment: str | None = None,
|
|
1442
|
+
exclude_hosts: list[str] | None = None,
|
|
1443
|
+
ssh_credential_id: EntityID | None = None,
|
|
1444
|
+
ssh_credential_port: int | str | None = None,
|
|
1445
|
+
smb_credential_id: EntityID | None = None,
|
|
1446
|
+
esxi_credential_id: EntityID | None = None,
|
|
1447
|
+
snmp_credential_id: EntityID | None = None,
|
|
1448
|
+
alive_test: str | AliveTest | AliveTestV224 | None = None,
|
|
1449
|
+
allow_simultaneous_ips: bool | None = None,
|
|
1450
|
+
reverse_lookup_only: bool | None = None,
|
|
1451
|
+
reverse_lookup_unify: bool | None = None,
|
|
1452
|
+
port_range: str | None = None,
|
|
1453
|
+
port_list_id: EntityID | None = None,
|
|
1454
|
+
) -> T:
|
|
1455
|
+
"""Create a new target
|
|
1456
|
+
|
|
1457
|
+
Args:
|
|
1458
|
+
name: Name of the target
|
|
1459
|
+
asset_hosts_filter: Filter to select target host from assets hosts
|
|
1460
|
+
hosts: List of hosts addresses to scan
|
|
1461
|
+
exclude_hosts: List of hosts addresses to exclude from scan
|
|
1462
|
+
comment: Comment for the target
|
|
1463
|
+
ssh_credential_id: UUID of a ssh credential to use on target
|
|
1464
|
+
ssh_credential_port: The port to use for ssh credential
|
|
1465
|
+
smb_credential_id: UUID of a smb credential to use on target
|
|
1466
|
+
snmp_credential_id: UUID of a snmp credential to use on target
|
|
1467
|
+
esxi_credential_id: UUID of a esxi credential to use on target
|
|
1468
|
+
alive_test: Which alive test to use
|
|
1469
|
+
allow_simultaneous_ips: Whether to scan multiple IPs of the
|
|
1470
|
+
same host simultaneously
|
|
1471
|
+
reverse_lookup_only: Whether to scan only hosts that have names
|
|
1472
|
+
reverse_lookup_unify: Whether to scan only one IP when multiple IPs
|
|
1473
|
+
have the same name.
|
|
1474
|
+
port_range: Port range for the target
|
|
1475
|
+
port_list_id: UUID of the port list to use on target
|
|
1476
|
+
"""
|
|
1477
|
+
return self._send_request_and_transform_response(
|
|
1478
|
+
Targets.create_target(
|
|
1479
|
+
name,
|
|
1480
|
+
asset_hosts_filter=asset_hosts_filter,
|
|
1481
|
+
hosts=hosts,
|
|
1482
|
+
comment=comment,
|
|
1483
|
+
exclude_hosts=exclude_hosts,
|
|
1484
|
+
ssh_credential_id=ssh_credential_id,
|
|
1485
|
+
ssh_credential_port=ssh_credential_port,
|
|
1486
|
+
smb_credential_id=smb_credential_id,
|
|
1487
|
+
esxi_credential_id=esxi_credential_id,
|
|
1488
|
+
snmp_credential_id=snmp_credential_id,
|
|
1489
|
+
alive_test=alive_test,
|
|
1490
|
+
allow_simultaneous_ips=allow_simultaneous_ips,
|
|
1491
|
+
reverse_lookup_only=reverse_lookup_only,
|
|
1492
|
+
reverse_lookup_unify=reverse_lookup_unify,
|
|
1493
|
+
port_range=port_range,
|
|
1494
|
+
port_list_id=port_list_id,
|
|
1495
|
+
)
|
|
1496
|
+
)
|
|
1497
|
+
|
|
1498
|
+
def modify_target(
|
|
1499
|
+
self,
|
|
1500
|
+
target_id: EntityID,
|
|
1501
|
+
*,
|
|
1502
|
+
name: str | None = None,
|
|
1503
|
+
comment: str | None = None,
|
|
1504
|
+
hosts: list[str] | None = None,
|
|
1505
|
+
exclude_hosts: list[str] | None = None,
|
|
1506
|
+
ssh_credential_id: EntityID | None = None,
|
|
1507
|
+
ssh_credential_port: str | int | None = None,
|
|
1508
|
+
smb_credential_id: EntityID | None = None,
|
|
1509
|
+
esxi_credential_id: EntityID | None = None,
|
|
1510
|
+
snmp_credential_id: EntityID | None = None,
|
|
1511
|
+
alive_test: str | AliveTest | AliveTestV224 | None = None,
|
|
1512
|
+
allow_simultaneous_ips: bool | None = None,
|
|
1513
|
+
reverse_lookup_only: bool | None = None,
|
|
1514
|
+
reverse_lookup_unify: bool | None = None,
|
|
1515
|
+
port_list_id: EntityID | None = None,
|
|
1516
|
+
) -> T:
|
|
1517
|
+
"""Modify an existing target.
|
|
1518
|
+
|
|
1519
|
+
Args:
|
|
1520
|
+
target_id: UUID of target to modify.
|
|
1521
|
+
comment: Comment on target.
|
|
1522
|
+
name: Name of target.
|
|
1523
|
+
hosts: List of target hosts.
|
|
1524
|
+
exclude_hosts: A list of hosts to exclude.
|
|
1525
|
+
ssh_credential_id: UUID of SSH credential to use on target.
|
|
1526
|
+
ssh_credential_port: The port to use for ssh credential
|
|
1527
|
+
smb_credential_id: UUID of SMB credential to use on target.
|
|
1528
|
+
esxi_credential_id: UUID of ESXi credential to use on target.
|
|
1529
|
+
snmp_credential_id: UUID of SNMP credential to use on target.
|
|
1530
|
+
port_list_id: UUID of port list describing ports to scan.
|
|
1531
|
+
alive_test: Which alive tests to use.
|
|
1532
|
+
allow_simultaneous_ips: Whether to scan multiple IPs of the
|
|
1533
|
+
same host simultaneously
|
|
1534
|
+
reverse_lookup_only: Whether to scan only hosts that have names.
|
|
1535
|
+
reverse_lookup_unify: Whether to scan only one IP when multiple IPs
|
|
1536
|
+
have the same name.
|
|
1537
|
+
"""
|
|
1538
|
+
return self._send_request_and_transform_response(
|
|
1539
|
+
Targets.modify_target(
|
|
1540
|
+
target_id,
|
|
1541
|
+
name=name,
|
|
1542
|
+
comment=comment,
|
|
1543
|
+
hosts=hosts,
|
|
1544
|
+
exclude_hosts=exclude_hosts,
|
|
1545
|
+
ssh_credential_id=ssh_credential_id,
|
|
1546
|
+
ssh_credential_port=ssh_credential_port,
|
|
1547
|
+
smb_credential_id=smb_credential_id,
|
|
1548
|
+
esxi_credential_id=esxi_credential_id,
|
|
1549
|
+
snmp_credential_id=snmp_credential_id,
|
|
1550
|
+
alive_test=alive_test,
|
|
1551
|
+
allow_simultaneous_ips=allow_simultaneous_ips,
|
|
1552
|
+
reverse_lookup_only=reverse_lookup_only,
|
|
1553
|
+
reverse_lookup_unify=reverse_lookup_unify,
|
|
1554
|
+
port_list_id=port_list_id,
|
|
1555
|
+
)
|
|
1556
|
+
)
|
|
1557
|
+
|
|
1558
|
+
def clone_target(self, target_id: EntityID) -> T:
|
|
1559
|
+
"""Clone an existing target.
|
|
1560
|
+
|
|
1561
|
+
Args:
|
|
1562
|
+
target_id: UUID of an existing target to clone.
|
|
1563
|
+
"""
|
|
1564
|
+
return self._send_request_and_transform_response(
|
|
1565
|
+
Targets.clone_target(target_id)
|
|
1566
|
+
)
|
|
1567
|
+
|
|
1568
|
+
def delete_target(
|
|
1569
|
+
self, target_id: EntityID, *, ultimate: bool | None = False
|
|
1570
|
+
) -> T:
|
|
1571
|
+
"""Delete an existing target.
|
|
1572
|
+
|
|
1573
|
+
Args:
|
|
1574
|
+
target_id: UUID of an existing target to delete.
|
|
1575
|
+
ultimate: Whether to remove entirely or to the trashcan.
|
|
1576
|
+
"""
|
|
1577
|
+
return self._send_request_and_transform_response(
|
|
1578
|
+
Targets.delete_target(target_id, ultimate=ultimate)
|
|
1579
|
+
)
|
|
1580
|
+
|
|
1581
|
+
def get_target(
|
|
1582
|
+
self, target_id: EntityID, *, tasks: bool | None = None
|
|
1583
|
+
) -> T:
|
|
1584
|
+
"""Request a single target.
|
|
1585
|
+
|
|
1586
|
+
Args:
|
|
1587
|
+
target_id: UUID of the target to request.
|
|
1588
|
+
tasks: Whether to include list of tasks that use the target
|
|
1589
|
+
"""
|
|
1590
|
+
return self._send_request_and_transform_response(
|
|
1591
|
+
Targets.get_target(target_id, tasks=tasks)
|
|
1592
|
+
)
|
|
1593
|
+
|
|
1594
|
+
def get_targets(
|
|
1595
|
+
self,
|
|
1596
|
+
*,
|
|
1597
|
+
filter_string: str | None = None,
|
|
1598
|
+
filter_id: EntityID | None = None,
|
|
1599
|
+
trash: bool | None = None,
|
|
1600
|
+
tasks: bool | None = None,
|
|
1601
|
+
) -> T:
|
|
1602
|
+
"""Request a list of targets.
|
|
1603
|
+
|
|
1604
|
+
Args:
|
|
1605
|
+
filter_string: Filter term to use for the query.
|
|
1606
|
+
filter_id: UUID of an existing filter to use for the query.
|
|
1607
|
+
trash: Whether to include targets in the trashcan.
|
|
1608
|
+
tasks: Whether to include list of tasks that use the target.
|
|
1609
|
+
"""
|
|
1610
|
+
return self._send_request_and_transform_response(
|
|
1611
|
+
Targets.get_targets(
|
|
1612
|
+
filter_string=filter_string,
|
|
1613
|
+
filter_id=filter_id,
|
|
1614
|
+
trash=trash,
|
|
1615
|
+
tasks=tasks,
|
|
1616
|
+
)
|
|
1617
|
+
)
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
|
|
5
5
|
from gvm.protocols.gmp.requests.next._agent_groups import AgentGroups
|
|
6
|
-
from gvm.protocols.gmp.requests.next.
|
|
6
|
+
from gvm.protocols.gmp.requests.next._agent_installer_instructions import (
|
|
7
|
+
AgentInstallerInstructionLanguageType,
|
|
8
|
+
AgentInstallerInstructions,
|
|
9
|
+
)
|
|
7
10
|
from gvm.protocols.gmp.requests.next._agents import Agents
|
|
8
11
|
from gvm.protocols.gmp.requests.next._credential_stores import CredentialStores
|
|
9
12
|
from gvm.protocols.gmp.requests.next._credentials import (
|
|
@@ -38,7 +41,14 @@ from gvm.protocols.gmp.requests.next._report_ports import (
|
|
|
38
41
|
from gvm.protocols.gmp.requests.next._report_tls_certificates import (
|
|
39
42
|
ReportTlsCertificates,
|
|
40
43
|
)
|
|
44
|
+
from gvm.protocols.gmp.requests.next._report_vulnerabilities import (
|
|
45
|
+
ReportVulnerabilities,
|
|
46
|
+
)
|
|
47
|
+
from gvm.protocols.gmp.requests.next._targets import AliveTest, Targets
|
|
41
48
|
from gvm.protocols.gmp.requests.next._tasks import Tasks
|
|
49
|
+
from gvm.protocols.gmp.requests.next._web_application_targets import (
|
|
50
|
+
WebApplicationTargets,
|
|
51
|
+
)
|
|
42
52
|
|
|
43
53
|
from .._entity_id import EntityID
|
|
44
54
|
from .._version import Version
|
|
@@ -49,7 +59,6 @@ from ..v227 import (
|
|
|
49
59
|
AlertEvent,
|
|
50
60
|
AlertMethod,
|
|
51
61
|
Alerts,
|
|
52
|
-
AliveTest,
|
|
53
62
|
AuditReports,
|
|
54
63
|
Audits,
|
|
55
64
|
Authentication,
|
|
@@ -99,7 +108,6 @@ from ..v227 import (
|
|
|
99
108
|
SortOrder,
|
|
100
109
|
SystemReports,
|
|
101
110
|
Tags,
|
|
102
|
-
Targets,
|
|
103
111
|
Tickets,
|
|
104
112
|
TicketStatus,
|
|
105
113
|
TLSCertificates,
|
|
@@ -112,7 +120,8 @@ from ..v227 import (
|
|
|
112
120
|
|
|
113
121
|
__all__ = (
|
|
114
122
|
"AgentGroups",
|
|
115
|
-
"
|
|
123
|
+
"AgentInstallerInstructionLanguageType",
|
|
124
|
+
"AgentInstallerInstructions",
|
|
116
125
|
"Agents",
|
|
117
126
|
"AggregateStatistic",
|
|
118
127
|
"Aggregates",
|
|
@@ -168,6 +177,7 @@ __all__ = (
|
|
|
168
177
|
"ReportOperatingSystems",
|
|
169
178
|
"ReportPorts",
|
|
170
179
|
"ReportTlsCertificates",
|
|
180
|
+
"ReportVulnerabilities",
|
|
171
181
|
"Reports",
|
|
172
182
|
"ResourceNames",
|
|
173
183
|
"ResourceType",
|
|
@@ -195,4 +205,5 @@ __all__ = (
|
|
|
195
205
|
"Users",
|
|
196
206
|
"Version",
|
|
197
207
|
"Vulnerabilities",
|
|
208
|
+
"WebApplicationTargets",
|
|
198
209
|
)
|
|
@@ -16,6 +16,7 @@ class AgentGroups:
|
|
|
16
16
|
cls,
|
|
17
17
|
name: str,
|
|
18
18
|
agent_ids: list[str],
|
|
19
|
+
scheduler_cron_time: str,
|
|
19
20
|
*,
|
|
20
21
|
comment: str | None = None,
|
|
21
22
|
) -> Request:
|
|
@@ -24,6 +25,7 @@ class AgentGroups:
|
|
|
24
25
|
Args:
|
|
25
26
|
name: Name of the new agent group.
|
|
26
27
|
agent_ids: List of agent UUIDs to include in the group (required).
|
|
28
|
+
scheduler_cron_time: Cron-like time to schedule new agent groups (required).
|
|
27
29
|
comment: Optional comment for the group.
|
|
28
30
|
|
|
29
31
|
Raises:
|
|
@@ -38,9 +40,15 @@ class AgentGroups:
|
|
|
38
40
|
raise RequiredArgument(
|
|
39
41
|
function=cls.create_agent_group.__name__, argument="agent_ids"
|
|
40
42
|
)
|
|
43
|
+
if not scheduler_cron_time:
|
|
44
|
+
raise RequiredArgument(
|
|
45
|
+
function=cls.create_agent_group.__name__,
|
|
46
|
+
argument="scheduler_cron_time",
|
|
47
|
+
)
|
|
41
48
|
|
|
42
49
|
cmd = XmlCommand("create_agent_group")
|
|
43
50
|
cmd.add_element("name", name)
|
|
51
|
+
cmd.add_element("scheduler_cron_time", scheduler_cron_time)
|
|
44
52
|
|
|
45
53
|
if comment:
|
|
46
54
|
cmd.add_element("comment", comment)
|
|
@@ -76,6 +84,7 @@ class AgentGroups:
|
|
|
76
84
|
def modify_agent_group(
|
|
77
85
|
cls,
|
|
78
86
|
agent_group_id: EntityID,
|
|
87
|
+
scheduler_cron_time: str,
|
|
79
88
|
*,
|
|
80
89
|
name: str | None = None,
|
|
81
90
|
comment: str | None = None,
|
|
@@ -85,6 +94,7 @@ class AgentGroups:
|
|
|
85
94
|
|
|
86
95
|
Args:
|
|
87
96
|
agent_group_id: UUID of the group to modify.
|
|
97
|
+
scheduler_cron_time: Cron-like time to schedule the agent groups.
|
|
88
98
|
name: Optional new name for the group.
|
|
89
99
|
comment: Optional comment for the group.
|
|
90
100
|
agent_ids: Optional list of agent UUIDs to set for the group.
|
|
@@ -98,9 +108,15 @@ class AgentGroups:
|
|
|
98
108
|
argument="agent_group_id",
|
|
99
109
|
)
|
|
100
110
|
|
|
111
|
+
if not scheduler_cron_time:
|
|
112
|
+
raise RequiredArgument(
|
|
113
|
+
function=cls.modify_agent_group.__name__,
|
|
114
|
+
argument="scheduler_cron_time",
|
|
115
|
+
)
|
|
116
|
+
|
|
101
117
|
cmd = XmlCommand("modify_agent_group")
|
|
102
118
|
cmd.set_attribute("agent_group_id", str(agent_group_id))
|
|
103
|
-
|
|
119
|
+
cmd.add_element("scheduler_cron_time", scheduler_cron_time)
|
|
104
120
|
if name:
|
|
105
121
|
cmd.add_element("name", name)
|
|
106
122
|
|