>>> get_cpe([{"children": [], "cpe_match": [{ ... "cpe23Uri": "cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*", ... "cpe_name": [], ... "versionEndIncluding": "1.2.5.1", ... "vulnerable": Tr
(nodes)
| 198 | |
| 199 | |
| 200 | def get_cpe(nodes) -> List: |
| 201 | """ |
| 202 | >>> get_cpe([{"children": [], "cpe_match": [{ |
| 203 | ... "cpe23Uri": "cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*", |
| 204 | ... "cpe_name": [], |
| 205 | ... "versionEndIncluding": "1.2.5.1", |
| 206 | ... "vulnerable": True |
| 207 | ... },{ |
| 208 | ... "cpe23Uri": "cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*", |
| 209 | ... "cpe_name": [], |
| 210 | ... "versionEndIncluding": "1.3.25", |
| 211 | ... "vulnerable": True |
| 212 | ... }],"operator": "OR"}]) |
| 213 | ['cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*', 'cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*'] |
| 214 | """ |
| 215 | cpe_list = [] |
| 216 | for node in nodes: |
| 217 | cpe_match = node.get("cpe_match") or [] |
| 218 | for cpe23Uri in cpe_match: |
| 219 | cpe_uri = cpe23Uri.get("cpe23Uri") |
| 220 | if cpe_uri: |
| 221 | cpe_list.append(cpe_uri) |
| 222 | return cpe_list |
no test coverage detected