MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / get_cpe

Function get_cpe

vulnerabilities/importers/gsd.py:200–222  ·  view source on GitHub ↗

>>> get_cpe([{"children": [], "cpe_match": [{ ... "cpe23Uri": "cpe:2.3:a:mutt:mutt:*:*:*:*:*:*:*:*", ... "cpe_name": [], ... "versionEndIncluding": "1.2.5.1", ... "vulnerable": Tr

(nodes)

Source from the content-addressed store, hash-verified

198
199
200def 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

Callers 1

parse_advisory_dataFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected