@@ 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( |