| @@ 143-178 (lines=36) @@ | ||
| 140 | ) |
|
| 141 | ) |
|
| 142 | ||
| 143 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
| 144 | """Request a single secinfo |
|
| 145 | ||
| 146 | Arguments: |
|
| 147 | info_id: UUID of an existing secinfo |
|
| 148 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
| 149 | DFN_CERT_ADV, OVALDEF, NVT |
|
| 150 | ||
| 151 | Returns: |
|
| 152 | The response. See :py:meth:`send_command` for details. |
|
| 153 | """ |
|
| 154 | if not info_type: |
|
| 155 | raise RequiredArgument( |
|
| 156 | function=self.get_info.__name__, argument='info_type' |
|
| 157 | ) |
|
| 158 | ||
| 159 | if not isinstance(info_type, InfoType): |
|
| 160 | raise InvalidArgumentType( |
|
| 161 | function=self.get_info.__name__, |
|
| 162 | argument='info_type', |
|
| 163 | arg_type=InfoType.__name__, |
|
| 164 | ) |
|
| 165 | ||
| 166 | if not info_id: |
|
| 167 | raise RequiredArgument( |
|
| 168 | function=self.get_info.__name__, argument='info_id' |
|
| 169 | ) |
|
| 170 | ||
| 171 | cmd = XmlCommand("get_info") |
|
| 172 | cmd.set_attribute("info_id", info_id) |
|
| 173 | ||
| 174 | cmd.set_attribute("type", info_type.value) |
|
| 175 | ||
| 176 | # for single entity always request all details |
|
| 177 | cmd.set_attribute("details", "1") |
|
| 178 | return self._send_xml_command(cmd) |
|
| 179 | ||
| 180 | def create_target( |
|
| 181 | self, |
|
| @@ 3261-3296 (lines=36) @@ | ||
| 3258 | ||
| 3259 | return self._send_xml_command(cmd) |
|
| 3260 | ||
| 3261 | def get_info(self, info_id: str, info_type: InfoType) -> Any: |
|
| 3262 | """Request a single secinfo |
|
| 3263 | ||
| 3264 | Arguments: |
|
| 3265 | info_id: UUID of an existing secinfo |
|
| 3266 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
| 3267 | DFN_CERT_ADV, OVALDEF, NVT or ALLINFO |
|
| 3268 | ||
| 3269 | Returns: |
|
| 3270 | The response. See :py:meth:`send_command` for details. |
|
| 3271 | """ |
|
| 3272 | cmd = XmlCommand("get_info") |
|
| 3273 | ||
| 3274 | if not info_type: |
|
| 3275 | raise RequiredArgument( |
|
| 3276 | function=self.get_info.__name__, argument='info_type' |
|
| 3277 | ) |
|
| 3278 | ||
| 3279 | if not isinstance(info_type, InfoType): |
|
| 3280 | raise InvalidArgumentType( |
|
| 3281 | function=self.get_info.__name__, |
|
| 3282 | argument='info_type', |
|
| 3283 | arg_type=InfoType.__name__, |
|
| 3284 | ) |
|
| 3285 | ||
| 3286 | if not info_id: |
|
| 3287 | raise RequiredArgument( |
|
| 3288 | function=self.get_info.__name__, argument='info_id' |
|
| 3289 | ) |
|
| 3290 | ||
| 3291 | cmd.set_attribute("info_id", info_id) |
|
| 3292 | ||
| 3293 | cmd.set_attribute("type", info_type.value) |
|
| 3294 | ||
| 3295 | # for single entity always request all details |
|
| 3296 | cmd.set_attribute("details", "1") |
|
| 3297 | ||
| 3298 | return self._send_xml_command(cmd) |
|
| 3299 | ||