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