| @@ 3228-3275 (lines=48) @@ | ||
| 3225 | cmd.set_attribute("group_id", group_id) |
|
| 3226 | return self._send_xml_command(cmd) |
|
| 3227 | ||
| 3228 | def get_info_list( |
|
| 3229 | self, |
|
| 3230 | info_type: InfoType, |
|
| 3231 | *, |
|
| 3232 | filter: Optional[str] = None, |
|
| 3233 | filter_id: Optional[str] = None, |
|
| 3234 | name: Optional[str] = None, |
|
| 3235 | details: Optional[bool] = None, |
|
| 3236 | ) -> Any: |
|
| 3237 | """Request a list of security information |
|
| 3238 | ||
| 3239 | Arguments: |
|
| 3240 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
| 3241 | DFN_CERT_ADV, OVALDEF, NVT or ALLINFO |
|
| 3242 | filter: Filter term to use for the query |
|
| 3243 | filter_id: UUID of an existing filter to use for the query |
|
| 3244 | name: Name or identifier of the requested information |
|
| 3245 | details: Whether to include information about references to this |
|
| 3246 | information |
|
| 3247 | ||
| 3248 | Returns: |
|
| 3249 | The response. See :py:meth:`send_command` for details. |
|
| 3250 | """ |
|
| 3251 | if not info_type: |
|
| 3252 | raise RequiredArgument( |
|
| 3253 | function=self.get_info_list.__name__, argument='info_type' |
|
| 3254 | ) |
|
| 3255 | ||
| 3256 | if not isinstance(info_type, InfoType): |
|
| 3257 | raise InvalidArgumentType( |
|
| 3258 | function=self.get_info_list.__name__, |
|
| 3259 | argument='info_type', |
|
| 3260 | arg_type=InfoType.__name__, |
|
| 3261 | ) |
|
| 3262 | ||
| 3263 | cmd = XmlCommand("get_info") |
|
| 3264 | ||
| 3265 | cmd.set_attribute("type", info_type.value) |
|
| 3266 | ||
| 3267 | _add_filter(cmd, filter, filter_id) |
|
| 3268 | ||
| 3269 | if name: |
|
| 3270 | cmd.set_attribute("name", name) |
|
| 3271 | ||
| 3272 | if details is not None: |
|
| 3273 | cmd.set_attribute("details", _to_bool(details)) |
|
| 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 |
|
| @@ 143-190 (lines=48) @@ | ||
| 140 | ) |
|
| 141 | ) |
|
| 142 | ||
| 143 | def get_info_list( |
|
| 144 | self, |
|
| 145 | info_type: InfoType, |
|
| 146 | *, |
|
| 147 | filter: Optional[str] = None, |
|
| 148 | filter_id: Optional[str] = None, |
|
| 149 | name: Optional[str] = None, |
|
| 150 | details: Optional[bool] = None, |
|
| 151 | ) -> Any: |
|
| 152 | """Request a list of security information |
|
| 153 | ||
| 154 | Arguments: |
|
| 155 | info_type: Type must be either CERT_BUND_ADV, CPE, CVE, |
|
| 156 | DFN_CERT_ADV, OVALDEF, NVT or ALLINFO |
|
| 157 | filter: Filter term to use for the query |
|
| 158 | filter_id: UUID of an existing filter to use for the query |
|
| 159 | name: Name or identifier of the requested information |
|
| 160 | details: Whether to include information about references to this |
|
| 161 | information |
|
| 162 | ||
| 163 | Returns: |
|
| 164 | The response. See :py:meth:`send_command` for details. |
|
| 165 | """ |
|
| 166 | if not info_type: |
|
| 167 | raise RequiredArgument( |
|
| 168 | function=self.get_info_list.__name__, argument='info_type' |
|
| 169 | ) |
|
| 170 | ||
| 171 | if not isinstance(info_type, InfoType): |
|
| 172 | raise InvalidArgumentType( |
|
| 173 | function=self.get_info_list.__name__, |
|
| 174 | argument='info_type', |
|
| 175 | arg_type=InfoType.__name__, |
|
| 176 | ) |
|
| 177 | ||
| 178 | cmd = XmlCommand("get_info") |
|
| 179 | ||
| 180 | cmd.set_attribute("type", info_type.value) |
|
| 181 | ||
| 182 | _add_filter(cmd, filter, filter_id) |
|
| 183 | ||
| 184 | if name: |
|
| 185 | cmd.set_attribute("name", name) |
|
| 186 | ||
| 187 | if details is not None: |
|
| 188 | cmd.set_attribute("details", _to_bool(details)) |
|
| 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 |
|