CPE (Common Platform Enumeration) is a standardized method for describing and identifying applications, operating systems, and hardware devices. The `cpe` Python library (version 1.3.1) provides functionality for parsing, representing, validating, and comparing CPE names across versions 1.1, 2.2, and 2.3 of the CPE specification. It is actively maintained with recent releases focusing on bug fixes and minor feature enhancements.
pip install cpeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create CPE objects from different specification versions (URI and 2.2 formatted string) and access their components. It also shows a basic comparison between two CPE objects.
Upgrade to `cpe` version 1.3.0 or later: `pip install --upgrade cpe`. Ensure your Python environment is reasonably current (Python 3.8+ is generally recommended for modern libraries).
Always be explicit about the CPE version you are working with. When constructing CPE objects, use the `version` parameter (e.g., `CPE(cpe_string, CPE.VERSION_2_2)`). Use conversion methods provided by the library if you need to compare or interact across different CPE specification versions.
Install the library using pip: `pip install cpe`. If using a virtual environment, ensure it is activated before installation and execution.
Review the CPE string for correct syntax, including proper delimiters, parts, and components. Consult the NIST CPE Specification documents or examples in the `cpe` library documentation for valid formats. Ensure correct escaping where necessary.
Verify the specific CPE object type and its available methods. If you need to work with specific representations (e.g., WFN fields), convert the CPE object to that representation first (e.g., `cpe_obj.as_wfn_object().get_edition_packed()`) or consult the documentation for the appropriate accessor based on the CPE specification version and binding type.
No dependency data recorded yet.