Skip to content

Commit

Permalink
Add: Add new API for parsing CPEs (pontos.cpe)
Browse files Browse the repository at this point in the history
Allow to parse and analyze CPE information from their v2.2 and v2.3
string representations. It's also possible to convert a v2.2 CPE
representation into a v2.3 and vice versa.

It follows the spec at https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf
very closely and implements all their escaping. Just the conversion to
percent-encoded strings for quoting non-alphanumeric characters is using
`urllib.parser.quote` and `unquote` which support additional quoting
besides specified in the CPE document.
  • Loading branch information
bjoernricks committed Oct 27, 2023
1 parent 84ee098 commit 79ec113
Show file tree
Hide file tree
Showing 4 changed files with 1,086 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pontos/cpe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2023 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later

from ._cpe import ANY, CPE, NA, CPEParsingError, Part

"""
Module for parsing and handling Common Platform Enumeration (CPE) information
"""

__all__ = (
"ANY",
"NA",
"CPEParsingError",
"Part",
"CPE",
)
Loading

0 comments on commit 79ec113

Please sign in to comment.