python-gvm 27.2.0__py3-none-any.whl → 27.3.1__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 +387 -37
- gvm/protocols/gmp/requests/next/__init__.py +11 -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/_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.2.0.dist-info → python_gvm-27.3.1.dist-info}/METADATA +1 -1
- {python_gvm-27.2.0.dist-info → python_gvm-27.3.1.dist-info}/RECORD +12 -10
- {python_gvm-27.2.0.dist-info → python_gvm-27.3.1.dist-info}/WHEEL +1 -1
- gvm/protocols/gmp/requests/next/_agent_installers.py +0 -81
- {python_gvm-27.2.0.dist-info → python_gvm-27.3.1.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,
|
|
@@ -28,8 +30,11 @@ from .requests.next import (
|
|
|
28
30
|
ReportPorts,
|
|
29
31
|
ReportTlsCertificates,
|
|
30
32
|
ReportVulnerabilities,
|
|
33
|
+
Targets,
|
|
31
34
|
Tasks,
|
|
35
|
+
WebApplicationTargets,
|
|
32
36
|
)
|
|
37
|
+
from .requests.v224 import AliveTest as AliveTestV224
|
|
33
38
|
from .requests.v224 import HostsOrdering
|
|
34
39
|
|
|
35
40
|
|
|
@@ -55,52 +60,25 @@ class GMPNext(GMPv227[T]):
|
|
|
55
60
|
def get_protocol_version() -> tuple[int, int]:
|
|
56
61
|
return (22, 8)
|
|
57
62
|
|
|
58
|
-
def
|
|
63
|
+
def get_agent_installer_instruction(
|
|
59
64
|
self,
|
|
60
65
|
*,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
trash: bool | None = None,
|
|
64
|
-
details: bool | None = None,
|
|
66
|
+
scanner_id: EntityID,
|
|
67
|
+
language_type: AgentInstallerInstructionLanguageType,
|
|
65
68
|
) -> T:
|
|
66
|
-
"""Request
|
|
69
|
+
"""Request an agent installer instruction.
|
|
67
70
|
|
|
68
71
|
Args:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
trash: Whether to get the trashcan agent installers instead
|
|
72
|
-
details: Whether to include extra details like tasks using this
|
|
73
|
-
scanner
|
|
72
|
+
scanner_id: UUID of the Agent controller to get the installer instruction for.
|
|
73
|
+
language_type: Language of the installer instruction.
|
|
74
74
|
"""
|
|
75
75
|
return self._send_request_and_transform_response(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
trash=trash,
|
|
80
|
-
details=details,
|
|
76
|
+
AgentInstallerInstructions.get_agent_installer_instruction(
|
|
77
|
+
scanner_id=scanner_id,
|
|
78
|
+
language_type=language_type,
|
|
81
79
|
)
|
|
82
80
|
)
|
|
83
81
|
|
|
84
|
-
def get_agent_installer(self, agent_installer_id: EntityID) -> T:
|
|
85
|
-
"""Request a single agent installer
|
|
86
|
-
|
|
87
|
-
Args:
|
|
88
|
-
agent_installer_id: UUID of an existing agent installer
|
|
89
|
-
"""
|
|
90
|
-
return self._send_request_and_transform_response(
|
|
91
|
-
AgentInstallers.get_agent_installer(agent_installer_id)
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
def get_agent_installer_file(self, agent_installer_id: EntityID) -> T:
|
|
95
|
-
"""Request a single agent installer file
|
|
96
|
-
|
|
97
|
-
Args:
|
|
98
|
-
agent_installer_id: UUID of an existing agent installer
|
|
99
|
-
"""
|
|
100
|
-
return self._send_request_and_transform_response(
|
|
101
|
-
AgentInstallers.get_agent_installer_file(agent_installer_id)
|
|
102
|
-
)
|
|
103
|
-
|
|
104
82
|
def get_agents(
|
|
105
83
|
self,
|
|
106
84
|
*,
|
|
@@ -228,6 +206,7 @@ class GMPNext(GMPv227[T]):
|
|
|
228
206
|
self,
|
|
229
207
|
name: str,
|
|
230
208
|
agent_ids: list[str],
|
|
209
|
+
scheduler_cron_time: str,
|
|
231
210
|
*,
|
|
232
211
|
comment: str | None = None,
|
|
233
212
|
) -> T:
|
|
@@ -236,6 +215,7 @@ class GMPNext(GMPv227[T]):
|
|
|
236
215
|
Args:
|
|
237
216
|
name: Name of the new agent group.
|
|
238
217
|
agent_ids: List of agent UUIDs to include in the group (required).
|
|
218
|
+
scheduler_cron_time: Scheduler cron to use.
|
|
239
219
|
comment: Optional comment for the group.
|
|
240
220
|
|
|
241
221
|
Raises:
|
|
@@ -246,12 +226,14 @@ class GMPNext(GMPv227[T]):
|
|
|
246
226
|
name=name,
|
|
247
227
|
comment=comment,
|
|
248
228
|
agent_ids=agent_ids,
|
|
229
|
+
scheduler_cron_time=scheduler_cron_time,
|
|
249
230
|
)
|
|
250
231
|
)
|
|
251
232
|
|
|
252
233
|
def modify_agent_group(
|
|
253
234
|
self,
|
|
254
235
|
agent_group_id: EntityID,
|
|
236
|
+
scheduler_cron_time: str,
|
|
255
237
|
*,
|
|
256
238
|
name: str | None = None,
|
|
257
239
|
comment: str | None = None,
|
|
@@ -262,6 +244,7 @@ class GMPNext(GMPv227[T]):
|
|
|
262
244
|
Args:
|
|
263
245
|
agent_group_id: UUID of the group to modify.
|
|
264
246
|
name: Optional new name for the group.
|
|
247
|
+
scheduler_cron_time: Scheduler cron to use.
|
|
265
248
|
comment: Optional comment for the group.
|
|
266
249
|
agent_ids: Optional list of agent UUIDs to set for the group.
|
|
267
250
|
|
|
@@ -274,6 +257,7 @@ class GMPNext(GMPv227[T]):
|
|
|
274
257
|
name=name,
|
|
275
258
|
comment=comment,
|
|
276
259
|
agent_ids=agent_ids,
|
|
260
|
+
scheduler_cron_time=scheduler_cron_time,
|
|
277
261
|
)
|
|
278
262
|
)
|
|
279
263
|
|
|
@@ -725,6 +709,49 @@ class GMPNext(GMPv227[T]):
|
|
|
725
709
|
Tasks.create_container_task(name=name, comment=comment)
|
|
726
710
|
)
|
|
727
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
|
+
|
|
728
755
|
def create_task(
|
|
729
756
|
self,
|
|
730
757
|
name: str,
|
|
@@ -842,6 +869,7 @@ class GMPNext(GMPv227[T]):
|
|
|
842
869
|
scanner_id: EntityID | None = None,
|
|
843
870
|
agent_group_id: EntityID | None = None,
|
|
844
871
|
oci_image_target_id: EntityID | None = None,
|
|
872
|
+
web_application_target_id: EntityID | None = None,
|
|
845
873
|
alterable: bool | None = None,
|
|
846
874
|
hosts_ordering: HostsOrdering | None = None,
|
|
847
875
|
schedule_id: EntityID | None = None,
|
|
@@ -861,6 +889,7 @@ class GMPNext(GMPv227[T]):
|
|
|
861
889
|
scanner_id: UUID of scanner to use for scanning the target
|
|
862
890
|
agent_group_id: UUID of agent group to use for scanning
|
|
863
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.
|
|
864
893
|
comment: The comment on the task.
|
|
865
894
|
alert_ids: List of UUIDs for alerts to be applied to the task
|
|
866
895
|
hosts_ordering: The order hosts are scanned in
|
|
@@ -880,6 +909,7 @@ class GMPNext(GMPv227[T]):
|
|
|
880
909
|
scanner_id=scanner_id,
|
|
881
910
|
agent_group_id=agent_group_id,
|
|
882
911
|
oci_image_target_id=oci_image_target_id,
|
|
912
|
+
web_application_target_id=web_application_target_id,
|
|
883
913
|
alterable=alterable,
|
|
884
914
|
hosts_ordering=hosts_ordering,
|
|
885
915
|
schedule_id=schedule_id,
|
|
@@ -1265,3 +1295,323 @@ class GMPNext(GMPv227[T]):
|
|
|
1265
1295
|
details=details,
|
|
1266
1296
|
)
|
|
1267
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 (
|
|
@@ -41,7 +44,11 @@ from gvm.protocols.gmp.requests.next._report_tls_certificates import (
|
|
|
41
44
|
from gvm.protocols.gmp.requests.next._report_vulnerabilities import (
|
|
42
45
|
ReportVulnerabilities,
|
|
43
46
|
)
|
|
47
|
+
from gvm.protocols.gmp.requests.next._targets import AliveTest, Targets
|
|
44
48
|
from gvm.protocols.gmp.requests.next._tasks import Tasks
|
|
49
|
+
from gvm.protocols.gmp.requests.next._web_application_targets import (
|
|
50
|
+
WebApplicationTargets,
|
|
51
|
+
)
|
|
45
52
|
|
|
46
53
|
from .._entity_id import EntityID
|
|
47
54
|
from .._version import Version
|
|
@@ -52,7 +59,6 @@ from ..v227 import (
|
|
|
52
59
|
AlertEvent,
|
|
53
60
|
AlertMethod,
|
|
54
61
|
Alerts,
|
|
55
|
-
AliveTest,
|
|
56
62
|
AuditReports,
|
|
57
63
|
Audits,
|
|
58
64
|
Authentication,
|
|
@@ -102,7 +108,6 @@ from ..v227 import (
|
|
|
102
108
|
SortOrder,
|
|
103
109
|
SystemReports,
|
|
104
110
|
Tags,
|
|
105
|
-
Targets,
|
|
106
111
|
Tickets,
|
|
107
112
|
TicketStatus,
|
|
108
113
|
TLSCertificates,
|
|
@@ -115,7 +120,8 @@ from ..v227 import (
|
|
|
115
120
|
|
|
116
121
|
__all__ = (
|
|
117
122
|
"AgentGroups",
|
|
118
|
-
"
|
|
123
|
+
"AgentInstallerInstructionLanguageType",
|
|
124
|
+
"AgentInstallerInstructions",
|
|
119
125
|
"Agents",
|
|
120
126
|
"AggregateStatistic",
|
|
121
127
|
"Aggregates",
|
|
@@ -199,4 +205,5 @@ __all__ = (
|
|
|
199
205
|
"Users",
|
|
200
206
|
"Version",
|
|
201
207
|
"Vulnerabilities",
|
|
208
|
+
"WebApplicationTargets",
|
|
202
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
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from gvm.errors import RequiredArgument
|
|
4
|
+
from gvm.protocols.core import Request
|
|
5
|
+
from gvm.protocols.gmp.requests._entity_id import EntityID
|
|
6
|
+
from gvm.xml import XmlCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AgentInstallerInstructionLanguageType(Enum):
|
|
10
|
+
EN = "en"
|
|
11
|
+
DE = "de"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AgentInstallerInstructions:
|
|
15
|
+
@classmethod
|
|
16
|
+
def get_agent_installer_instruction(
|
|
17
|
+
cls,
|
|
18
|
+
scanner_id: EntityID,
|
|
19
|
+
language_type: AgentInstallerInstructionLanguageType,
|
|
20
|
+
) -> Request:
|
|
21
|
+
"""Request an agent installer instruction.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
scanner_id: UUID of the Agent controller to get the installer instruction for.
|
|
25
|
+
language_type: Language of the installer instruction.
|
|
26
|
+
"""
|
|
27
|
+
if not scanner_id:
|
|
28
|
+
raise RequiredArgument(
|
|
29
|
+
function=cls.get_agent_installer_instruction.__name__,
|
|
30
|
+
argument="scanner_id",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if not language_type:
|
|
34
|
+
raise RequiredArgument(
|
|
35
|
+
function=cls.get_agent_installer_instruction.__name__,
|
|
36
|
+
argument="language_type",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
cmd = XmlCommand("get_agent_installer_instruction")
|
|
40
|
+
cmd.set_attribute("scanner_id", str(scanner_id))
|
|
41
|
+
cmd.set_attribute("language", language_type.value)
|
|
42
|
+
|
|
43
|
+
return cmd
|