@@ 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 |
@@ 2284-2319 (lines=36) @@ | ||
2281 | ||
2282 | return self._send_xml_command(cmd) |
|
2283 | ||
2284 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
2285 | """Request a single secinfo |
|
2286 | ||
2287 | Arguments: |
|
2288 | info_id: UUID of an existing secinfo |
|
2289 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
2290 | DFN_CERT_ADV, OVALDEF, NVT |
|
2291 | ||
2292 | Returns: |
|
2293 | The response. See :py:meth:`send_command` for details. |
|
2294 | """ |
|
2295 | if not info_type: |
|
2296 | raise RequiredArgument( |
|
2297 | function=self.get_info.__name__, argument='info_type' |
|
2298 | ) |
|
2299 | ||
2300 | if not isinstance(info_type, InfoType): |
|
2301 | raise InvalidArgumentType( |
|
2302 | function=self.get_info.__name__, |
|
2303 | argument='info_type', |
|
2304 | arg_type=InfoType.__name__, |
|
2305 | ) |
|
2306 | ||
2307 | if not info_id: |
|
2308 | raise RequiredArgument( |
|
2309 | function=self.get_info.__name__, argument='info_id' |
|
2310 | ) |
|
2311 | ||
2312 | cmd = XmlCommand("get_info") |
|
2313 | cmd.set_attribute("info_id", info_id) |
|
2314 | ||
2315 | cmd.set_attribute("type", info_type.value) |
|
2316 | ||
2317 | # for single entity always request all details |
|
2318 | cmd.set_attribute("details", "1") |
|
2319 | return self._send_xml_command(cmd) |
|
2320 | ||
2321 | def create_target( |
|
2322 | self, |