vulnersCom / api

Vulners Python API wrapper
GNU General Public License v3.0
356 stars 60 forks source link

CPE to CVE #41

Closed luai24 closed 5 months ago

luai24 commented 1 year ago

So I have a question, what if I want an exact CVE for a CPE, For example, cpe:/a:apache:http_server:2.2.8 should return one vulnerability because I specified the version. I have no clue how to do that using this API.

Thanks in advance.

vulnersCom commented 5 months ago

If you want to get all the vulnerabilities applicable to this CPE you can do it this way:

import vulners

vulners_api = vulners.VulnersApi(api_key="<YOR KEY HERE>")
cve_results = vulners_api.get_cpe_vulnerabilities(cpe="cpe:/a:apache:http_server:2.2.8")
print("\n".join(["%s" % _['id'] for _ in cve_results.get('NVD')]))