|
@@ 258-310 (lines=53) @@
|
| 255 |
|
|
| 256 |
|
return self._send_xml_command(cmd) |
| 257 |
|
|
| 258 |
|
def create_audit( |
| 259 |
|
self, |
| 260 |
|
name: str, |
| 261 |
|
policy_id: str, |
| 262 |
|
target_id: str, |
| 263 |
|
scanner_id: str, |
| 264 |
|
*, |
| 265 |
|
alterable: Optional[bool] = None, |
| 266 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 267 |
|
schedule_id: Optional[str] = None, |
| 268 |
|
alert_ids: Optional[List[str]] = None, |
| 269 |
|
comment: Optional[str] = None, |
| 270 |
|
schedule_periods: Optional[int] = None, |
| 271 |
|
observers: Optional[List[str]] = None, |
| 272 |
|
preferences: Optional[dict] = None |
| 273 |
|
) -> Any: |
| 274 |
|
"""Create a new audit task |
| 275 |
|
|
| 276 |
|
Arguments: |
| 277 |
|
name: Name of the new audit |
| 278 |
|
policy_id: UUID of policy to use by the audit |
| 279 |
|
target_id: UUID of target to be scanned |
| 280 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 281 |
|
comment: Comment for the audit |
| 282 |
|
alterable: Whether the task should be alterable |
| 283 |
|
alert_ids: List of UUIDs for alerts to be applied to the audit |
| 284 |
|
hosts_ordering: The order hosts are scanned in |
| 285 |
|
schedule_id: UUID of a schedule when the audit should be run. |
| 286 |
|
schedule_periods: A limit to the number of times the audit will be |
| 287 |
|
scheduled, or 0 for no limit |
| 288 |
|
observers: List of names or ids of users which should be allowed to |
| 289 |
|
observe this audit |
| 290 |
|
preferences: Name/Value pairs of scanner preferences. |
| 291 |
|
|
| 292 |
|
Returns: |
| 293 |
|
The response. See :py:meth:`send_command` for details. |
| 294 |
|
""" |
| 295 |
|
|
| 296 |
|
return self.__create_task( |
| 297 |
|
name=name, |
| 298 |
|
config_id=policy_id, |
| 299 |
|
target_id=target_id, |
| 300 |
|
scanner_id=scanner_id, |
| 301 |
|
usage_type=UsageType.AUDIT, |
| 302 |
|
function=self.create_audit.__name__, |
| 303 |
|
alterable=alterable, |
| 304 |
|
hosts_ordering=hosts_ordering, |
| 305 |
|
schedule_id=schedule_id, |
| 306 |
|
alert_ids=alert_ids, |
| 307 |
|
comment=comment, |
| 308 |
|
schedule_periods=schedule_periods, |
| 309 |
|
observers=observers, |
| 310 |
|
preferences=preferences, |
| 311 |
|
) |
| 312 |
|
|
| 313 |
|
def create_config(self, config_id: str, name: str) -> Any: |
|
@@ 350-401 (lines=52) @@
|
| 347 |
|
function=self.create_policy.__name__, |
| 348 |
|
) |
| 349 |
|
|
| 350 |
|
def create_task( |
| 351 |
|
self, |
| 352 |
|
name: str, |
| 353 |
|
config_id: str, |
| 354 |
|
target_id: str, |
| 355 |
|
scanner_id: str, |
| 356 |
|
*, |
| 357 |
|
alterable: Optional[bool] = None, |
| 358 |
|
hosts_ordering: Optional[HostsOrdering] = None, |
| 359 |
|
schedule_id: Optional[str] = None, |
| 360 |
|
alert_ids: Optional[List[str]] = None, |
| 361 |
|
comment: Optional[str] = None, |
| 362 |
|
schedule_periods: Optional[int] = None, |
| 363 |
|
observers: Optional[List[str]] = None, |
| 364 |
|
preferences: Optional[dict] = None |
| 365 |
|
) -> Any: |
| 366 |
|
"""Create a new scan task |
| 367 |
|
|
| 368 |
|
Arguments: |
| 369 |
|
name: Name of the task |
| 370 |
|
config_id: UUID of scan config to use by the task |
| 371 |
|
target_id: UUID of target to be scanned |
| 372 |
|
scanner_id: UUID of scanner to use for scanning the target |
| 373 |
|
comment: Comment for the task |
| 374 |
|
alterable: Whether the task should be alterable |
| 375 |
|
alert_ids: List of UUIDs for alerts to be applied to the task |
| 376 |
|
hosts_ordering: The order hosts are scanned in |
| 377 |
|
schedule_id: UUID of a schedule when the task should be run. |
| 378 |
|
schedule_periods: A limit to the number of times the task will be |
| 379 |
|
scheduled, or 0 for no limit |
| 380 |
|
observers: List of names or ids of users which should be allowed to |
| 381 |
|
observe this task |
| 382 |
|
preferences: Name/Value pairs of scanner preferences. |
| 383 |
|
|
| 384 |
|
Returns: |
| 385 |
|
The response. See :py:meth:`send_command` for details. |
| 386 |
|
""" |
| 387 |
|
return self.__create_task( |
| 388 |
|
name=name, |
| 389 |
|
config_id=config_id, |
| 390 |
|
target_id=target_id, |
| 391 |
|
scanner_id=scanner_id, |
| 392 |
|
usage_type=UsageType.SCAN, |
| 393 |
|
function=self.create_task.__name__, |
| 394 |
|
alterable=alterable, |
| 395 |
|
hosts_ordering=hosts_ordering, |
| 396 |
|
schedule_id=schedule_id, |
| 397 |
|
alert_ids=alert_ids, |
| 398 |
|
comment=comment, |
| 399 |
|
schedule_periods=schedule_periods, |
| 400 |
|
observers=observers, |
| 401 |
|
preferences=preferences, |
| 402 |
|
) |
| 403 |
|
|
| 404 |
|
def create_tls_certificate( |