@@ 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( |
|
@@ 394-445 (lines=52) @@ | ||
391 | function=self.create_policy.__name__, |
|
392 | ) |
|
393 | ||
394 | def create_task( |
|
395 | self, |
|
396 | name: str, |
|
397 | config_id: str, |
|
398 | target_id: str, |
|
399 | scanner_id: str, |
|
400 | *, |
|
401 | alterable: Optional[bool] = None, |
|
402 | hosts_ordering: Optional[HostsOrdering] = None, |
|
403 | schedule_id: Optional[str] = None, |
|
404 | alert_ids: Optional[List[str]] = None, |
|
405 | comment: Optional[str] = None, |
|
406 | schedule_periods: Optional[int] = None, |
|
407 | observers: Optional[List[str]] = None, |
|
408 | preferences: Optional[dict] = None |
|
409 | ) -> Any: |
|
410 | """Create a new scan task |
|
411 | ||
412 | Arguments: |
|
413 | name: Name of the task |
|
414 | config_id: UUID of scan config to use by the task |
|
415 | target_id: UUID of target to be scanned |
|
416 | scanner_id: UUID of scanner to use for scanning the target |
|
417 | comment: Comment for the task |
|
418 | alterable: Whether the task should be alterable |
|
419 | alert_ids: List of UUIDs for alerts to be applied to the task |
|
420 | hosts_ordering: The order hosts are scanned in |
|
421 | schedule_id: UUID of a schedule when the task should be run. |
|
422 | schedule_periods: A limit to the number of times the task will be |
|
423 | scheduled, or 0 for no limit |
|
424 | observers: List of names or ids of users which should be allowed to |
|
425 | observe this task |
|
426 | preferences: Name/Value pairs of scanner preferences. |
|
427 | ||
428 | Returns: |
|
429 | The response. See :py:meth:`send_command` for details. |
|
430 | """ |
|
431 | return self.__create_task( |
|
432 | name=name, |
|
433 | config_id=config_id, |
|
434 | target_id=target_id, |
|
435 | scanner_id=scanner_id, |
|
436 | usage_type=UsageType.SCAN, |
|
437 | function=self.create_task.__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_tls_certificate( |