| @@ 176-222 (lines=47) @@ | ||
| 173 | ||
| 174 | return self._send_xml_command(cmd) |
|
| 175 | ||
| 176 | def modify_policy_set_nvt_preference( |
|
| 177 | self, |
|
| 178 | policy_id: str, |
|
| 179 | name: str, |
|
| 180 | nvt_oid: str, |
|
| 181 | *, |
|
| 182 | value: Optional[str] = None, |
|
| 183 | ) -> Any: |
|
| 184 | """Modifies the nvt preferences of an existing policy. |
|
| 185 | ||
| 186 | Arguments: |
|
| 187 | policy_id: UUID of policy to modify. |
|
| 188 | name: Name for preference to change. |
|
| 189 | nvt_oid: OID of the NVT associated with preference to modify |
|
| 190 | value: New value for the preference. None to delete the preference |
|
| 191 | and to use the default instead. |
|
| 192 | """ |
|
| 193 | if not policy_id: |
|
| 194 | raise RequiredArgument( |
|
| 195 | function=self.modify_policy_set_nvt_preference.__name__, |
|
| 196 | argument='policy_id', |
|
| 197 | ) |
|
| 198 | ||
| 199 | if not nvt_oid: |
|
| 200 | raise RequiredArgument( |
|
| 201 | function=self.modify_policy_set_nvt_preference.__name__, |
|
| 202 | argument='nvt_oid', |
|
| 203 | ) |
|
| 204 | ||
| 205 | if not name: |
|
| 206 | raise RequiredArgument( |
|
| 207 | function=self.modify_policy_set_nvt_preference.__name__, |
|
| 208 | argument='name', |
|
| 209 | ) |
|
| 210 | ||
| 211 | cmd = XmlCommand("modify_config") |
|
| 212 | cmd.set_attribute("config_id", str(policy_id)) |
|
| 213 | ||
| 214 | _xmlpref = cmd.add_element("preference") |
|
| 215 | ||
| 216 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
| 217 | _xmlpref.add_element("name", name) |
|
| 218 | ||
| 219 | if value: |
|
| 220 | _xmlpref.add_element("value", to_base64(value)) |
|
| 221 | ||
| 222 | return self._send_xml_command(cmd) |
|
| 223 | ||
| 224 | def modify_policy_set_name(self, policy_id: str, name: str) -> Any: |
|
| 225 | """Modifies the name of an existing policy |
|
| @@ 302-348 (lines=47) @@ | ||
| 299 | ||
| 300 | return self._send_xml_command(cmd) |
|
| 301 | ||
| 302 | def modify_scan_config_set_nvt_preference( |
|
| 303 | self, |
|
| 304 | config_id: str, |
|
| 305 | name: str, |
|
| 306 | nvt_oid: str, |
|
| 307 | *, |
|
| 308 | value: Optional[str] = None, |
|
| 309 | ) -> Any: |
|
| 310 | """Modifies the nvt preferences of an existing scan config. |
|
| 311 | ||
| 312 | Arguments: |
|
| 313 | config_id: UUID of scan config to modify. |
|
| 314 | name: Name for nvt preference to change. |
|
| 315 | nvt_oid: OID of the NVT associated with preference to modify |
|
| 316 | value: New value for the preference. None to delete the preference |
|
| 317 | and to use the default instead. |
|
| 318 | """ |
|
| 319 | if not config_id: |
|
| 320 | raise RequiredArgument( |
|
| 321 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
| 322 | argument='config_id', |
|
| 323 | ) |
|
| 324 | ||
| 325 | if not nvt_oid: |
|
| 326 | raise RequiredArgument( |
|
| 327 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
| 328 | argument='nvt_oid', |
|
| 329 | ) |
|
| 330 | ||
| 331 | if not name: |
|
| 332 | raise RequiredArgument( |
|
| 333 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
| 334 | argument='name', |
|
| 335 | ) |
|
| 336 | ||
| 337 | cmd = XmlCommand("modify_config") |
|
| 338 | cmd.set_attribute("config_id", str(config_id)) |
|
| 339 | ||
| 340 | _xmlpref = cmd.add_element("preference") |
|
| 341 | ||
| 342 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
| 343 | _xmlpref.add_element("name", name) |
|
| 344 | ||
| 345 | if value: |
|
| 346 | _xmlpref.add_element("value", to_base64(value)) |
|
| 347 | ||
| 348 | return self._send_xml_command(cmd) |
|
| 349 | ||
| 350 | def modify_scan_config_set_name(self, config_id: str, name: str) -> Any: |
|
| 351 | """Modifies the name of an existing scan config |
|