Search CPE

Searching for CPEs is similar to searching for CVEs albeit less parameters. CPE match strings are allowed, meaning if partial strings are known, you can search for all possible CPE names. Like searching CVEs, the parameters are not positional.

Here is an example search with a keyword and a limit of 2 results then iterate through said CPE names.


Due to rate limiting restrictions by NIST, a request will take 6 seconds with no API key.
Requests with an API key take 0.6 seconds per request.
Get a NIST NVD API key here (free): https://nvd.nist.gov/developers/request-an-api-key
import nvdlib

r = nvdlib.searchCPE(keyword = 'Microsoft Exchange', limit = 2)
for eachCPE in r:

nvdlib.cpe.searchCPE(cpeNameId=False, cpeMatchString=False, keywordExactMatch=False, keywordSearch=False, lastModStartDate=False, lastModEndDate=False, matchCriteriaId=False, limit=False, key=False, delay=False, verbose=False)[source]

Build and send GET request then return list of objects containing a collection of CPEs.

  • cpeNameId (str) – Returns a specific CPE record using its UUID. If a correctly formatted UUID is passed but it does not exist, it will return empty results. The UUID is the cpeNameId value when searching CPE.

  • cpeMatchString (str) – Use a partial CPE name to search for other CPE names.

  • keywordExactMatch (bool) – Searches metadata within CPE title and reference links for an exact match of the phrase or word passed to it. Must be included with keywordSearch.

  • keywordSearch (str) – Returns CPE records where a word or phrase is found in the metadata title or reference links. Space characters act as an AND statement.

  • lastModStartDate (str/datetime obj) –

    CPE last modification start date. Maximum 120 day range. A start and end date is required. All times are in UTC 00:00.

    A datetime object or string can be passed as a date. NVDLib will automatically parse the datetime object into the correct format.

    String Example: ‘2020-06-28 00:00’

  • lastModEndDate (str/datetime obj) – CPE last modification end date. Maximum 120 day range. Must be included with lastModStartDate. Example: ‘2020-06-28 00:00’

  • limit (int) – Limits the number of results of the search.

  • key (str) – NVD API Key. Allows for a request every 0.6 seconds instead of 6 seconds.

  • delay – Can only be used if an API key is provided. The amount of time to sleep in between requests. Must be a value above 0.6 seconds if an API key is present. delay is set to 6 seconds if no API key is passed.

  • verbose (bool) – Prints the URL request for debugging purposes.

class nvdlib.classes.CPE(response)[source]

JSON dump class for CPEs

  • deprecated (bool) – Indicates whether CPE has been deprecated

  • cpeName – CPE URI name

  • cpeNameId (str) – CPE UUID

  • lastModifiedDate – CPE modification date

  • created (str) – CPE creation date

  • titles – List of available titles for the CPE

  • deprecatedBy – If deprecated=true, one or more CPE that replace this one

  • vulnerabilities (list) – Optional vulnerabilities associated with this CPE. Must use ‘cves = true’ argument in searchCPE.

CPE Search Examples

Filter for a partial cpeMatchString for Microsoft Exchange 2013, return all the vulnerabilities for said matching CPEs, and print their CVE IDs.


CVEs returned using searchCPE do not contain details and are only the ID.

r = nvdlib.searchCPE(cpeMatchString='cpe:2.3:a:microsoft:exchange_server:2013:', cves=True, key='xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx')
for eachCPE in r:
    for eachVuln in eachCPE.vulnerabilities:

Filter for CPE names modfied between 2019-01-01 and 2021-01-01 with the keyword of PHP.


There is a maximum 120 day range when using date ranges. If searching publication or modified dates, start and end dates are required. A datetime object can also be used instead of a string.

len(r) will return how many CPE (or CVE) entries were found in the result.
r = nvdlib.searchCPE(modStartDate='2019-01-01 00:00', modEndDate='2020-01-01 00:00', keyword='PHP')


Filter for all CPE names modified in the last 30 days using datetime objects.

>>> import datetime
>>> end = datetime.datetime.now()
>>> start = end - datetime.timedelta(days=30)
>>> r = nvdlib.searchCPE(modStartDate=start, modEndDate=end)