@@ 3277-3312 (lines=36) @@ | ||
3274 | ||
3275 | return self._send_xml_command(cmd) |
|
3276 | ||
3277 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
3278 | """Request a single secinfo |
|
3279 | ||
3280 | Arguments: |
|
3281 | info_id: UUID of an existing secinfo |
|
3282 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
3283 | DFN_CERT_ADV, OVALDEF, NVT or ALLINFO |
|
3284 | ||
3285 | Returns: |
|
3286 | The response. See :py:meth:`send_command` for details. |
|
3287 | """ |
|
3288 | cmd = XmlCommand("get_info") |
|
3289 | ||
3290 | if not info_type: |
|
3291 | raise RequiredArgument( |
|
3292 | function=self.get_info.__name__, argument='info_type' |
|
3293 | ) |
|
3294 | ||
3295 | if not isinstance(info_type, InfoType): |
|
3296 | raise InvalidArgumentType( |
|
3297 | function=self.get_info.__name__, |
|
3298 | argument='info_type', |
|
3299 | arg_type=InfoType.__name__, |
|
3300 | ) |
|
3301 | ||
3302 | if not info_id: |
|
3303 | raise RequiredArgument( |
|
3304 | function=self.get_info.__name__, argument='info_id' |
|
3305 | ) |
|
3306 | ||
3307 | cmd.set_attribute("info_id", info_id) |
|
3308 | ||
3309 | cmd.set_attribute("type", info_type.value) |
|
3310 | ||
3311 | # for single entity always request all details |
|
3312 | cmd.set_attribute("details", "1") |
|
3313 | ||
3314 | return self._send_xml_command(cmd) |
|
3315 |
@@ 192-227 (lines=36) @@ | ||
189 | ||
190 | return self._send_xml_command(cmd) |
|
191 | ||
192 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
193 | """Request a single secinfo |
|
194 | ||
195 | Arguments: |
|
196 | info_id: UUID of an existing secinfo |
|
197 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
198 | DFN_CERT_ADV, OVALDEF, NVT |
|
199 | ||
200 | Returns: |
|
201 | The response. See :py:meth:`send_command` for details. |
|
202 | """ |
|
203 | if not info_type: |
|
204 | raise RequiredArgument( |
|
205 | function=self.get_info.__name__, argument='info_type' |
|
206 | ) |
|
207 | ||
208 | if not isinstance(info_type, InfoType): |
|
209 | raise InvalidArgumentType( |
|
210 | function=self.get_info.__name__, |
|
211 | argument='info_type', |
|
212 | arg_type=InfoType.__name__, |
|
213 | ) |
|
214 | ||
215 | if not info_id: |
|
216 | raise RequiredArgument( |
|
217 | function=self.get_info.__name__, argument='info_id' |
|
218 | ) |
|
219 | ||
220 | cmd = XmlCommand("get_info") |
|
221 | cmd.set_attribute("info_id", info_id) |
|
222 | ||
223 | cmd.set_attribute("type", info_type.value) |
|
224 | ||
225 | # for single entity always request all details |
|
226 | cmd.set_attribute("details", "1") |
|
227 | return self._send_xml_command(cmd) |
|
228 | ||
229 | def create_target( |
|
230 | self, |