| @@ 272-324 (lines=53) @@ | ||
| 269 | ||
| 270 | return self._send_xml_command(cmd) |
|
| 271 | ||
| 272 | def create_audit( |
|
| 273 | self, |
|
| 274 | name: str, |
|
| 275 | policy_id: str, |
|
| 276 | target_id: str, |
|
| 277 | scanner_id: str, |
|
| 278 | *, |
|
| 279 | alterable: Optional[bool] = None, |
|
| 280 | hosts_ordering: Optional[HostsOrdering] = None, |
|
| 281 | schedule_id: Optional[str] = None, |
|
| 282 | alert_ids: Optional[List[str]] = None, |
|
| 283 | comment: Optional[str] = None, |
|
| 284 | schedule_periods: Optional[int] = None, |
|
| 285 | observers: Optional[List[str]] = None, |
|
| 286 | preferences: Optional[dict] = None, |
|
| 287 | ) -> Any: |
|
| 288 | """Create a new audit task |
|
| 289 | ||
| 290 | Arguments: |
|
| 291 | name: Name of the new audit |
|
| 292 | policy_id: UUID of policy to use by the audit |
|
| 293 | target_id: UUID of target to be scanned |
|
| 294 | scanner_id: UUID of scanner to use for scanning the target |
|
| 295 | comment: Comment for the audit |
|
| 296 | alterable: Whether the task should be alterable |
|
| 297 | alert_ids: List of UUIDs for alerts to be applied to the audit |
|
| 298 | hosts_ordering: The order hosts are scanned in |
|
| 299 | schedule_id: UUID of a schedule when the audit should be run. |
|
| 300 | schedule_periods: A limit to the number of times the audit will be |
|
| 301 | scheduled, or 0 for no limit |
|
| 302 | observers: List of names or ids of users which should be allowed to |
|
| 303 | observe this audit |
|
| 304 | preferences: Name/Value pairs of scanner preferences. |
|
| 305 | ||
| 306 | Returns: |
|
| 307 | The response. See :py:meth:`send_command` for details. |
|
| 308 | """ |
|
| 309 | ||
| 310 | return self.__create_task( |
|
| 311 | name=name, |
|
| 312 | config_id=policy_id, |
|
| 313 | target_id=target_id, |
|
| 314 | scanner_id=scanner_id, |
|
| 315 | usage_type=UsageType.AUDIT, |
|
| 316 | function=self.create_audit.__name__, |
|
| 317 | alterable=alterable, |
|
| 318 | hosts_ordering=hosts_ordering, |
|
| 319 | schedule_id=schedule_id, |
|
| 320 | alert_ids=alert_ids, |
|
| 321 | comment=comment, |
|
| 322 | schedule_periods=schedule_periods, |
|
| 323 | observers=observers, |
|
| 324 | preferences=preferences, |
|
| 325 | ) |
|
| 326 | ||
| 327 | def create_config( |
|
| @@ 566-617 (lines=52) @@ | ||
| 563 | ||
| 564 | return self._send_xml_command(cmd) |
|
| 565 | ||
| 566 | def create_task( |
|
| 567 | self, |
|
| 568 | name: str, |
|
| 569 | config_id: str, |
|
| 570 | target_id: str, |
|
| 571 | scanner_id: str, |
|
| 572 | *, |
|
| 573 | alterable: Optional[bool] = None, |
|
| 574 | hosts_ordering: Optional[HostsOrdering] = None, |
|
| 575 | schedule_id: Optional[str] = None, |
|
| 576 | alert_ids: Optional[List[str]] = None, |
|
| 577 | comment: Optional[str] = None, |
|
| 578 | schedule_periods: Optional[int] = None, |
|
| 579 | observers: Optional[List[str]] = None, |
|
| 580 | preferences: Optional[dict] = None, |
|
| 581 | ) -> Any: |
|
| 582 | """Create a new scan task |
|
| 583 | ||
| 584 | Arguments: |
|
| 585 | name: Name of the task |
|
| 586 | config_id: UUID of scan config to use by the task |
|
| 587 | target_id: UUID of target to be scanned |
|
| 588 | scanner_id: UUID of scanner to use for scanning the target |
|
| 589 | comment: Comment for the task |
|
| 590 | alterable: Whether the task should be alterable |
|
| 591 | alert_ids: List of UUIDs for alerts to be applied to the task |
|
| 592 | hosts_ordering: The order hosts are scanned in |
|
| 593 | schedule_id: UUID of a schedule when the task should be run. |
|
| 594 | schedule_periods: A limit to the number of times the task will be |
|
| 595 | scheduled, or 0 for no limit |
|
| 596 | observers: List of names or ids of users which should be allowed to |
|
| 597 | observe this task |
|
| 598 | preferences: Name/Value pairs of scanner preferences. |
|
| 599 | ||
| 600 | Returns: |
|
| 601 | The response. See :py:meth:`send_command` for details. |
|
| 602 | """ |
|
| 603 | return self.__create_task( |
|
| 604 | name=name, |
|
| 605 | config_id=config_id, |
|
| 606 | target_id=target_id, |
|
| 607 | scanner_id=scanner_id, |
|
| 608 | usage_type=UsageType.SCAN, |
|
| 609 | function=self.create_task.__name__, |
|
| 610 | alterable=alterable, |
|
| 611 | hosts_ordering=hosts_ordering, |
|
| 612 | schedule_id=schedule_id, |
|
| 613 | alert_ids=alert_ids, |
|
| 614 | comment=comment, |
|
| 615 | schedule_periods=schedule_periods, |
|
| 616 | observers=observers, |
|
| 617 | preferences=preferences, |
|
| 618 | ) |
|
| 619 | ||
| 620 | def create_tls_certificate( |
|
| @@ 393-445 (lines=53) @@ | ||
| 390 | ||
| 391 | return self._send_xml_command(cmd) |
|
| 392 | ||
| 393 | def create_audit( |
|
| 394 | self, |
|
| 395 | name: str, |
|
| 396 | policy_id: str, |
|
| 397 | target_id: str, |
|
| 398 | scanner_id: str, |
|
| 399 | *, |
|
| 400 | alterable: Optional[bool] = None, |
|
| 401 | hosts_ordering: Optional[HostsOrdering] = None, |
|
| 402 | schedule_id: Optional[str] = None, |
|
| 403 | alert_ids: Optional[List[str]] = None, |
|
| 404 | comment: Optional[str] = None, |
|
| 405 | schedule_periods: Optional[int] = None, |
|
| 406 | observers: Optional[List[str]] = None, |
|
| 407 | preferences: Optional[dict] = None, |
|
| 408 | ) -> Any: |
|
| 409 | """Create a new audit task |
|
| 410 | ||
| 411 | Arguments: |
|
| 412 | name: Name of the new audit |
|
| 413 | policy_id: UUID of policy to use by the audit |
|
| 414 | target_id: UUID of target to be scanned |
|
| 415 | scanner_id: UUID of scanner to use for scanning the target |
|
| 416 | comment: Comment for the audit |
|
| 417 | alterable: Whether the task should be alterable |
|
| 418 | alert_ids: List of UUIDs for alerts to be applied to the audit |
|
| 419 | hosts_ordering: The order hosts are scanned in |
|
| 420 | schedule_id: UUID of a schedule when the audit should be run. |
|
| 421 | schedule_periods: A limit to the number of times the audit will be |
|
| 422 | scheduled, or 0 for no limit |
|
| 423 | observers: List of names or ids of users which should be allowed to |
|
| 424 | observe this audit |
|
| 425 | preferences: Name/Value pairs of scanner preferences. |
|
| 426 | ||
| 427 | Returns: |
|
| 428 | The response. See :py:meth:`send_command` for details. |
|
| 429 | """ |
|
| 430 | ||
| 431 | return self.__create_task( |
|
| 432 | name=name, |
|
| 433 | config_id=policy_id, |
|
| 434 | target_id=target_id, |
|
| 435 | scanner_id=scanner_id, |
|
| 436 | usage_type=UsageType.AUDIT, |
|
| 437 | function=self.create_audit.__name__, |
|
| 438 | alterable=alterable, |
|
| 439 | hosts_ordering=hosts_ordering, |
|
| 440 | schedule_id=schedule_id, |
|
| 441 | alert_ids=alert_ids, |
|
| 442 | comment=comment, |
|
| 443 | schedule_periods=schedule_periods, |
|
| 444 | observers=observers, |
|
| 445 | preferences=preferences, |
|
| 446 | ) |
|
| 447 | ||
| 448 | def create_config( |
|
| @@ 687-738 (lines=52) @@ | ||
| 684 | ||
| 685 | return self._send_xml_command(cmd) |
|
| 686 | ||
| 687 | def create_task( |
|
| 688 | self, |
|
| 689 | name: str, |
|
| 690 | config_id: str, |
|
| 691 | target_id: str, |
|
| 692 | scanner_id: str, |
|
| 693 | *, |
|
| 694 | alterable: Optional[bool] = None, |
|
| 695 | hosts_ordering: Optional[HostsOrdering] = None, |
|
| 696 | schedule_id: Optional[str] = None, |
|
| 697 | alert_ids: Optional[List[str]] = None, |
|
| 698 | comment: Optional[str] = None, |
|
| 699 | schedule_periods: Optional[int] = None, |
|
| 700 | observers: Optional[List[str]] = None, |
|
| 701 | preferences: Optional[dict] = None, |
|
| 702 | ) -> Any: |
|
| 703 | """Create a new scan task |
|
| 704 | ||
| 705 | Arguments: |
|
| 706 | name: Name of the task |
|
| 707 | config_id: UUID of scan config to use by the task |
|
| 708 | target_id: UUID of target to be scanned |
|
| 709 | scanner_id: UUID of scanner to use for scanning the target |
|
| 710 | comment: Comment for the task |
|
| 711 | alterable: Whether the task should be alterable |
|
| 712 | alert_ids: List of UUIDs for alerts to be applied to the task |
|
| 713 | hosts_ordering: The order hosts are scanned in |
|
| 714 | schedule_id: UUID of a schedule when the task should be run. |
|
| 715 | schedule_periods: A limit to the number of times the task will be |
|
| 716 | scheduled, or 0 for no limit |
|
| 717 | observers: List of names or ids of users which should be allowed to |
|
| 718 | observe this task |
|
| 719 | preferences: Name/Value pairs of scanner preferences. |
|
| 720 | ||
| 721 | Returns: |
|
| 722 | The response. See :py:meth:`send_command` for details. |
|
| 723 | """ |
|
| 724 | return self.__create_task( |
|
| 725 | name=name, |
|
| 726 | config_id=config_id, |
|
| 727 | target_id=target_id, |
|
| 728 | scanner_id=scanner_id, |
|
| 729 | usage_type=UsageType.SCAN, |
|
| 730 | function=self.create_task.__name__, |
|
| 731 | alterable=alterable, |
|
| 732 | hosts_ordering=hosts_ordering, |
|
| 733 | schedule_id=schedule_id, |
|
| 734 | alert_ids=alert_ids, |
|
| 735 | comment=comment, |
|
| 736 | schedule_periods=schedule_periods, |
|
| 737 | observers=observers, |
|
| 738 | preferences=preferences, |
|
| 739 | ) |
|
| 740 | ||
| 741 | def create_tls_certificate( |
|