@@ 6027-6073 (lines=47) @@ | ||
6024 | ||
6025 | return self._send_xml_command(cmd) |
|
6026 | ||
6027 | def modify_config_set_nvt_preference( |
|
6028 | self, |
|
6029 | config_id: str, |
|
6030 | name: str, |
|
6031 | nvt_oid: str, |
|
6032 | *, |
|
6033 | value: Optional[str] = None, |
|
6034 | ) -> Any: |
|
6035 | """Modifies the nvt preferences of an existing scan config. |
|
6036 | ||
6037 | Arguments: |
|
6038 | config_id: UUID of scan config to modify. |
|
6039 | name: Name for nvt preference to change. |
|
6040 | nvt_oid: OID of the NVT associated with preference to modify |
|
6041 | value: New value for the preference. None to delete the preference |
|
6042 | and to use the default instead. |
|
6043 | """ |
|
6044 | if not config_id: |
|
6045 | raise RequiredArgument( |
|
6046 | function=self.modify_config_set_nvt_preference.__name__, |
|
6047 | argument='config_id', |
|
6048 | ) |
|
6049 | ||
6050 | if not nvt_oid: |
|
6051 | raise RequiredArgument( |
|
6052 | function=self.modify_config_set_nvt_preference.__name__, |
|
6053 | argument='nvt_oid', |
|
6054 | ) |
|
6055 | ||
6056 | if not name: |
|
6057 | raise RequiredArgument( |
|
6058 | function=self.modify_config_set_nvt_preference.__name__, |
|
6059 | argument='name', |
|
6060 | ) |
|
6061 | ||
6062 | cmd = XmlCommand("modify_config") |
|
6063 | cmd.set_attribute("config_id", str(config_id)) |
|
6064 | ||
6065 | _xmlpref = cmd.add_element("preference") |
|
6066 | ||
6067 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
6068 | _xmlpref.add_element("name", name) |
|
6069 | ||
6070 | if value: |
|
6071 | _xmlpref.add_element("value", _to_base64(value)) |
|
6072 | ||
6073 | return self._send_xml_command(cmd) |
|
6074 | ||
6075 | def modify_config_set_name(self, config_id: str, name: str) -> Any: |
|
6076 | """Modifies the name of an existing scan config |
@@ 4593-4639 (lines=47) @@ | ||
4590 | ||
4591 | return self._send_xml_command(cmd) |
|
4592 | ||
4593 | def modify_config_set_nvt_preference( |
|
4594 | self, |
|
4595 | config_id: str, |
|
4596 | name: str, |
|
4597 | nvt_oid: str, |
|
4598 | *, |
|
4599 | value: Optional[str] = None, |
|
4600 | ) -> Any: |
|
4601 | """Modifies the nvt preferences of an existing scan config. |
|
4602 | ||
4603 | Arguments: |
|
4604 | config_id: UUID of scan config to modify. |
|
4605 | name: Name for nvt preference to change. |
|
4606 | nvt_oid: OID of the NVT associated with preference to modify |
|
4607 | value: New value for the preference. None to delete the preference |
|
4608 | and to use the default instead. |
|
4609 | """ |
|
4610 | if not config_id: |
|
4611 | raise RequiredArgument( |
|
4612 | function=self.modify_config_set_nvt_preference.__name__, |
|
4613 | argument='config_id', |
|
4614 | ) |
|
4615 | ||
4616 | if not nvt_oid: |
|
4617 | raise RequiredArgument( |
|
4618 | function=self.modify_config_set_nvt_preference.__name__, |
|
4619 | argument='nvt_oid', |
|
4620 | ) |
|
4621 | ||
4622 | if not name: |
|
4623 | raise RequiredArgument( |
|
4624 | function=self.modify_config_set_nvt_preference.__name__, |
|
4625 | argument='name', |
|
4626 | ) |
|
4627 | ||
4628 | cmd = XmlCommand("modify_config") |
|
4629 | cmd.set_attribute("config_id", str(config_id)) |
|
4630 | ||
4631 | _xmlpref = cmd.add_element("preference") |
|
4632 | ||
4633 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
4634 | _xmlpref.add_element("name", name) |
|
4635 | ||
4636 | if value: |
|
4637 | _xmlpref.add_element("value", _to_base64(value)) |
|
4638 | ||
4639 | return self._send_xml_command(cmd) |
|
4640 | ||
4641 | def modify_config_set_name(self, config_id: str, name: str) -> Any: |
|
4642 | """Modifies the name of an existing scan config |