@@ 243-289 (lines=47) @@ | ||
240 | ||
241 | return self._send_xml_command(cmd) |
|
242 | ||
243 | def modify_scan_config_set_nvt_preference( |
|
244 | self, |
|
245 | config_id: str, |
|
246 | name: str, |
|
247 | nvt_oid: str, |
|
248 | *, |
|
249 | value: Optional[str] = None, |
|
250 | ) -> Any: |
|
251 | """Modifies the nvt preferences of an existing scan config. |
|
252 | ||
253 | Arguments: |
|
254 | config_id: UUID of scan config to modify. |
|
255 | name: Name for nvt preference to change. |
|
256 | nvt_oid: OID of the NVT associated with preference to modify |
|
257 | value: New value for the preference. None to delete the preference |
|
258 | and to use the default instead. |
|
259 | """ |
|
260 | if not config_id: |
|
261 | raise RequiredArgument( |
|
262 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
263 | argument='config_id', |
|
264 | ) |
|
265 | ||
266 | if not nvt_oid: |
|
267 | raise RequiredArgument( |
|
268 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
269 | argument='nvt_oid', |
|
270 | ) |
|
271 | ||
272 | if not name: |
|
273 | raise RequiredArgument( |
|
274 | function=self.modify_scan_config_set_nvt_preference.__name__, |
|
275 | argument='name', |
|
276 | ) |
|
277 | ||
278 | cmd = XmlCommand("modify_config") |
|
279 | cmd.set_attribute("config_id", str(config_id)) |
|
280 | ||
281 | _xmlpref = cmd.add_element("preference") |
|
282 | ||
283 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
284 | _xmlpref.add_element("name", name) |
|
285 | ||
286 | if value: |
|
287 | _xmlpref.add_element("value", to_base64(value)) |
|
288 | ||
289 | return self._send_xml_command(cmd) |
|
290 | ||
291 | def modify_scan_config_set_name(self, config_id: str, name: str) -> Any: |
|
292 | """Modifies the name of an existing scan config |
@@ 180-226 (lines=47) @@ | ||
177 | ||
178 | return self._send_xml_command(cmd) |
|
179 | ||
180 | def modify_policy_set_nvt_preference( |
|
181 | self, |
|
182 | policy_id: str, |
|
183 | name: str, |
|
184 | nvt_oid: str, |
|
185 | *, |
|
186 | value: Optional[str] = None, |
|
187 | ) -> Any: |
|
188 | """Modifies the nvt preferences of an existing policy. |
|
189 | ||
190 | Arguments: |
|
191 | policy_id: UUID of policy to modify. |
|
192 | name: Name for preference to change. |
|
193 | nvt_oid: OID of the NVT associated with preference to modify |
|
194 | value: New value for the preference. None to delete the preference |
|
195 | and to use the default instead. |
|
196 | """ |
|
197 | if not policy_id: |
|
198 | raise RequiredArgument( |
|
199 | function=self.modify_policy_set_nvt_preference.__name__, |
|
200 | argument='policy_id', |
|
201 | ) |
|
202 | ||
203 | if not nvt_oid: |
|
204 | raise RequiredArgument( |
|
205 | function=self.modify_policy_set_nvt_preference.__name__, |
|
206 | argument='nvt_oid', |
|
207 | ) |
|
208 | ||
209 | if not name: |
|
210 | raise RequiredArgument( |
|
211 | function=self.modify_policy_set_nvt_preference.__name__, |
|
212 | argument='name', |
|
213 | ) |
|
214 | ||
215 | cmd = XmlCommand("modify_config") |
|
216 | cmd.set_attribute("config_id", str(policy_id)) |
|
217 | ||
218 | _xmlpref = cmd.add_element("preference") |
|
219 | ||
220 | _xmlpref.add_element("nvt", attrs={"oid": nvt_oid}) |
|
221 | _xmlpref.add_element("name", name) |
|
222 | ||
223 | if value: |
|
224 | _xmlpref.add_element("value", to_base64(value)) |
|
225 | ||
226 | return self._send_xml_command(cmd) |
|
227 | ||
228 | def modify_policy_set_name(self, policy_id: str, name: str) -> Any: |
|
229 | """Modifies the name of an existing policy |