|
@@ 270-322 (lines=53) @@
|
| 267 |
|
|
| 268 |
|
return self._send_xml_command(cmd) |
| 269 |
|
|
| 270 |
|
def create_audit( |
| 271 |
|
self, |
| 272 |
|
name: str, |
| 273 |
|
policy_id: str, |
| 274 |
|
target_id: str, |
| 275 |
|
scanner_id: str, |
| 276 |
|
*, |
| 277 |
|
alterable: Optional[bool] = None, |
| 278 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 279 |
|
schedule_id: Optional[str] = None, |
| 280 |
|
alert_ids: Optional[List[str]] = None, |
| 281 |
|
comment: Optional[str] = None, |
| 282 |
|
schedule_periods: Optional[int] = None, |
| 283 |
|
observers: Optional[List[str]] = None, |
| 284 |
|
preferences: Optional[dict] = None |
| 285 |
|
) -> Any: |
| 286 |
|
"""Create a new audit task |
| 287 |
|
|
| 288 |
|
Arguments: |
| 289 |
|
name: Name of the new audit |
| 290 |
|
policy_id: UUID of policy to use by the audit |
| 291 |
|
target_id: UUID of target to be scanned |
| 292 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 293 |
|
comment: Comment for the audit |
| 294 |
|
alterable: Whether the task should be alterable |
| 295 |
|
alert_ids: List of UUIDs for alerts to be applied to the audit |
| 296 |
|
hosts_ordering: The order hosts are scanned in |
| 297 |
|
schedule_id: UUID of a schedule when the audit should be run. |
| 298 |
|
schedule_periods: A limit to the number of times the audit will be |
| 299 |
|
scheduled, or 0 for no limit |
| 300 |
|
observers: List of names or ids of users which should be allowed to |
| 301 |
|
observe this audit |
| 302 |
|
preferences: Name/Value pairs of scanner preferences. |
| 303 |
|
|
| 304 |
|
Returns: |
| 305 |
|
The response. See :py:meth:`send_command` for details. |
| 306 |
|
""" |
| 307 |
|
|
| 308 |
|
return self.__create_task( |
| 309 |
|
name=name, |
| 310 |
|
config_id=policy_id, |
| 311 |
|
target_id=target_id, |
| 312 |
|
scanner_id=scanner_id, |
| 313 |
|
usage_type=UsageType.AUDIT, |
| 314 |
|
function=self.create_audit.__name__, |
| 315 |
|
alterable=alterable, |
| 316 |
|
hosts_ordering=hosts_ordering, |
| 317 |
|
schedule_id=schedule_id, |
| 318 |
|
alert_ids=alert_ids, |
| 319 |
|
comment=comment, |
| 320 |
|
schedule_periods=schedule_periods, |
| 321 |
|
observers=observers, |
| 322 |
|
preferences=preferences, |
| 323 |
|
) |
| 324 |
|
|
| 325 |
|
def create_config( |
|
@@ 564-615 (lines=52) @@
|
| 561 |
|
|
| 562 |
|
return self._send_xml_command(cmd) |
| 563 |
|
|
| 564 |
|
def create_task( |
| 565 |
|
self, |
| 566 |
|
name: str, |
| 567 |
|
config_id: str, |
| 568 |
|
target_id: str, |
| 569 |
|
scanner_id: str, |
| 570 |
|
*, |
| 571 |
|
alterable: Optional[bool] = None, |
| 572 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 573 |
|
schedule_id: Optional[str] = None, |
| 574 |
|
alert_ids: Optional[List[str]] = None, |
| 575 |
|
comment: Optional[str] = None, |
| 576 |
|
schedule_periods: Optional[int] = None, |
| 577 |
|
observers: Optional[List[str]] = None, |
| 578 |
|
preferences: Optional[dict] = None |
| 579 |
|
) -> Any: |
| 580 |
|
"""Create a new scan task |
| 581 |
|
|
| 582 |
|
Arguments: |
| 583 |
|
name: Name of the task |
| 584 |
|
config_id: UUID of scan config to use by the task |
| 585 |
|
target_id: UUID of target to be scanned |
| 586 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 587 |
|
comment: Comment for the task |
| 588 |
|
alterable: Whether the task should be alterable |
| 589 |
|
alert_ids: List of UUIDs for alerts to be applied to the task |
| 590 |
|
hosts_ordering: The order hosts are scanned in |
| 591 |
|
schedule_id: UUID of a schedule when the task should be run. |
| 592 |
|
schedule_periods: A limit to the number of times the task will be |
| 593 |
|
scheduled, or 0 for no limit |
| 594 |
|
observers: List of names or ids of users which should be allowed to |
| 595 |
|
observe this task |
| 596 |
|
preferences: Name/Value pairs of scanner preferences. |
| 597 |
|
|
| 598 |
|
Returns: |
| 599 |
|
The response. See :py:meth:`send_command` for details. |
| 600 |
|
""" |
| 601 |
|
return self.__create_task( |
| 602 |
|
name=name, |
| 603 |
|
config_id=config_id, |
| 604 |
|
target_id=target_id, |
| 605 |
|
scanner_id=scanner_id, |
| 606 |
|
usage_type=UsageType.SCAN, |
| 607 |
|
function=self.create_task.__name__, |
| 608 |
|
alterable=alterable, |
| 609 |
|
hosts_ordering=hosts_ordering, |
| 610 |
|
schedule_id=schedule_id, |
| 611 |
|
alert_ids=alert_ids, |
| 612 |
|
comment=comment, |
| 613 |
|
schedule_periods=schedule_periods, |
| 614 |
|
observers=observers, |
| 615 |
|
preferences=preferences, |
| 616 |
|
) |
| 617 |
|
|
| 618 |
|
def create_tls_certificate( |