CPE1_1 class

class cpe.cpe1_1.CPE1_1(cpe_str, *args, **kwargs)

Implementation of version 1.1 of CPE specification.

Basic structure of CPE Name:

  • Hardware part: the physical platform supporting the IT system.
  • Operating system part: the operating system controls and manages the IT hardware.
  • Application part: software systems, services, servers, and packages installed on the system.

CPE Name syntax:

cpe:/ {hardware-part} [ / {OS-part} [ / {application-part} ] ]

Returns the i’th component name of CPE Name.

Parameters:i (int) – component index to find
Returns:component string found
Return type:CPEComponent
Exception:IndexError - index not found in CPE Name

TEST: good index

>>> str = 'cpe:///sun_microsystem:sun@os:5.9:#update'
>>> c = CPE1_1(str)
>>> c[0]

Returns the number of components of CPE Name.

Returns:count of components of CPE Name
Return type:int

TEST: a CPE Name with two parts (hw and os) and some elements empty and with values

>>> str = "cpe:/cisco::3825/cisco:ios:12.3:enterprise"
>>> c = CPE1_1(str)
>>> len(c)
static __new__(cpe_str, *args, **kwargs)

Create a new CPE Name of version 1.1.

Parameters:cpe_str (string) – CPE Name string
Returns:CPE object of version 1.1 of CPE specification.
Return type:CPE1_1

Returns the CPE Name as Well-Formed Name string of version 2.3.

Returns:CPE Name as WFN string
Return type:string
Exception:TypeError - incompatible version

Returns the values of attribute “att_name” of CPE Name. By default a only element in each part.

Parameters:att_name (string) – Attribute name to get
Returns:List of attribute values
Return type:list
Exception:ValueError - invalid attribute name