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.0.1.tar.gz (9.1 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.0.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cpelib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 475e84b3501ad49be8f134a4ff721358bb95c1e2f29e5fa2301958201584d134
MD5 5e3c90ae890b153d2736ac45d1386a95
BLAKE2b-256 f61369bc2c03a86d6145db9b624c1eca922c039a8d1aa10a8b146b4d448aefe6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cpelib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba9cee701185c37fb7d12b248a19fea06d7c769cd550306606210e69ed60e3f3
MD5 4d1cb03e2a6214f0f733f5ff540147f8
BLAKE2b-256 c248485215ebc21cdced02e27e2abebe5ae7d9d1e3d8d88091a19e7849c6311f

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