@@ 311-352 (lines=42) @@ | ||
308 | ||
309 | return self._send_xml_command(cmd) |
|
310 | ||
311 | def modify_policy_set_nvt_selection( |
|
312 | self, policy_id: str, family: str, nvt_oids: List[str] |
|
313 | ) -> Any: |
|
314 | """Modifies the selected nvts of an existing policy |
|
315 | ||
316 | The manager updates the given family in the policy to include only the |
|
317 | given NVTs. |
|
318 | ||
319 | Arguments: |
|
320 | policy_id: UUID of policy to modify. |
|
321 | family: Name of the NVT family to include NVTs from |
|
322 | nvt_oids: List of NVTs to select for the family. |
|
323 | """ |
|
324 | if not policy_id: |
|
325 | raise RequiredArgument( |
|
326 | function=self.modify_policy_set_nvt_selection.__name__, |
|
327 | argument='policy_id', |
|
328 | ) |
|
329 | ||
330 | if not family: |
|
331 | raise RequiredArgument( |
|
332 | function=self.modify_policy_set_nvt_selection.__name__, |
|
333 | argument='family argument', |
|
334 | ) |
|
335 | ||
336 | if not is_list_like(nvt_oids): |
|
337 | raise InvalidArgumentType( |
|
338 | function=self.modify_policy_set_nvt_selection.__name__, |
|
339 | argument='nvt_oids', |
|
340 | arg_type='list', |
|
341 | ) |
|
342 | ||
343 | cmd = XmlCommand("modify_config") |
|
344 | cmd.set_attribute("config_id", str(policy_id)) |
|
345 | ||
346 | _xmlnvtsel = cmd.add_element("nvt_selection") |
|
347 | _xmlnvtsel.add_element("family", family) |
|
348 | ||
349 | for nvt in nvt_oids: |
|
350 | _xmlnvtsel.add_element("nvt", attrs={"oid": nvt}) |
|
351 | ||
352 | return self._send_xml_command(cmd) |
|
353 | ||
354 | def modify_policy_set_family_selection( |
|
355 | self, |
@@ 441-482 (lines=42) @@ | ||
438 | ||
439 | return self._send_xml_command(cmd) |
|
440 | ||
441 | def modify_scan_config_set_nvt_selection( |
|
442 | self, config_id: str, family: str, nvt_oids: List[str] |
|
443 | ) -> Any: |
|
444 | """Modifies the selected nvts of an existing scan config |
|
445 | ||
446 | The manager updates the given family in the config to include only the |
|
447 | given NVTs. |
|
448 | ||
449 | Arguments: |
|
450 | config_id: UUID of scan config to modify. |
|
451 | family: Name of the NVT family to include NVTs from |
|
452 | nvt_oids: List of NVTs to select for the family. |
|
453 | """ |
|
454 | if not config_id: |
|
455 | raise RequiredArgument( |
|
456 | function=self.modify_scan_config_set_nvt_selection.__name__, |
|
457 | argument='config_id', |
|
458 | ) |
|
459 | ||
460 | if not family: |
|
461 | raise RequiredArgument( |
|
462 | function=self.modify_scan_config_set_nvt_selection.__name__, |
|
463 | argument='family argument', |
|
464 | ) |
|
465 | ||
466 | if not is_list_like(nvt_oids): |
|
467 | raise InvalidArgumentType( |
|
468 | function=self.modify_scan_config_set_nvt_selection.__name__, |
|
469 | argument='nvt_oids', |
|
470 | arg_type='list', |
|
471 | ) |
|
472 | ||
473 | cmd = XmlCommand("modify_config") |
|
474 | cmd.set_attribute("config_id", str(config_id)) |
|
475 | ||
476 | _xmlnvtsel = cmd.add_element("nvt_selection") |
|
477 | _xmlnvtsel.add_element("family", family) |
|
478 | ||
479 | for nvt in nvt_oids: |
|
480 | _xmlnvtsel.add_element("nvt", attrs={"oid": nvt}) |
|
481 | ||
482 | return self._send_xml_command(cmd) |
|
483 | ||
484 | def modify_scan_config_set_family_selection( |
|
485 | self, |