cpelib
A Python package for parsing, representing, and filtering the NVD CPE Dictionary.
Installation
pip install cpelib
Setup
Before using the package, you need to download the NVD CPE Dictionary V2.3. You can download the latest version from the NVD website: https://nvd.nist.gov/products/cpe
After downloading the file (e.g., official-cpe-dictionary_v2.3.xml), you can use the cpelib package to parse the
file.
By default, the package looks for the file in the ~/.cpelib directory.
mkdir ~/.cpelib
mv official-cpe-dictionary_v2.3.xml ~/.cpelib
Or, you can programmatically change the path by providing the path to the file in the CPEDictionaryLoader class.
from cpelib.core.loader import CPEDictionaryLoader
loader = CPEDictionaryLoader(xml_file="path/to/official-cpe-dictionary_v2.3.xml")
Usage
[NOTE] It will take around 2 minutes to parse the entire XML file which contains over 1,341,950 CPE items. Also, makes sure you have enough memory to load the entire dictionary (16GB should be safe).
Use class CPEDictionaryLoader to define and initialize the loader, then call the loader to parse the XML file. The loader will return a dictionary with the cpe-item entries.
from cpelib.core.loader import CPEDictionaryLoader
loader = CPEDictionaryLoader()
cpe_dict = loader()
Additionally, you can explore the examples in the examples directory and run them using the following command:
python3 -m examples.load_cpe_dict
Metadata
Release files for cpelib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cpelib-0.2.0.tar.gz | 12.0 kB | Without provenance | Details for cpelib-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cpelib-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cpelib-0.2.0-py3-none-any.whl |
Total release size: 25.7 kB
Release files / cpelib-0.2.0.tar.gz
| Download URL | cpelib-0.2.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d79a688f9a824e21aef8a563ca1f5842815b8a3d7df8611ffdb52feecb9ee7b7
|
|
BLAKE2b-256 checksum How to use checksums |
3a4c9fa39bc69d4b943b6ebc44cc72106480a5c61247f2d0f5311cec699ed725
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.7
|
Release files / cpelib-0.2.0-py3-none-any.whl
| Download URL | cpelib-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
171acada784b6763815157fe4df316eda76671ac8debbdeb4eeb4942cd5accaf
|
|
BLAKE2b-256 checksum How to use checksums |
8a6cec1e71bc02769bec9385554ef0f5f2ba0a72ac003cc26f67a2b324af4915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.7
|
Security for cpelib 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.