Skip to main content

A Python package for parsing, representing, and filtering the NVD CPE Dictionary.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpelib-0.2.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpelib-0.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file cpelib-0.2.0.tar.gz.

File metadata

  • Download URL: cpelib-0.2.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.7

File hashes

Hashes for cpelib-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d79a688f9a824e21aef8a563ca1f5842815b8a3d7df8611ffdb52feecb9ee7b7
MD5 628aac1ac191ff153db162c00b802609
BLAKE2b-256 3a4c9fa39bc69d4b943b6ebc44cc72106480a5c61247f2d0f5311cec699ed725

See more details on using hashes here.

File details

Details for the file cpelib-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cpelib-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.7

File hashes

Hashes for cpelib-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 171acada784b6763815157fe4df316eda76671ac8debbdeb4eeb4942cd5accaf
MD5 8ec1f5182cd7d9871ade365171408fd6
BLAKE2b-256 8a6cec1e71bc02769bec9385554ef0f5f2ba0a72ac003cc26f67a2b324af4915

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page